很抱歉这个问题,但是可以制作单选按钮而不是从这段代码中选择列表吗?
function _nodereview_form_review(&$form, $axis, $node) {
static $options;
if (!isset($options)) {
$options = array(
20 => -2,
40 => -1,
60 => 0,
80 => 1,
100 => 2,
);
}
$form['reviews'][$axis->aid] = array(
'#type' => 'fieldset',
'#title' => $axis->tag,
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['reviews'][$axis->aid]['score'] = array(
'#type' => 'select',
'#title' => t('Score'),
'#options' => $options,
'#default_value' => $node->reviews[$axis->aid]['score'] ? $node->reviews[$axis->aid]['score'] : 50,
'#description' => $axis->description,
'#required' => TRUE,
);
if (NODEREVIEW_FIVESTAR_ENABLE) {
$form['reviews'][$axis->aid]['score']['#type'] = 'fivestar';
$form['reviews'][$axis->aid]['score']['#stars'] = variable_get('nodereview_fivestar_stars', 5);
}
$form['reviews'][$axis->aid]['review'] = array(
'#type' => 'textarea',
'#title' => t('Review'),
'#default_value' => $node->reviews[$axis->aid]['review'],
'#required' => TRUE,
);
}
我知道'#type'=> 'select'应为'#type'=> '收音机',但其他东西也应该改变。我不知道到底是什么。
感谢任何建议。
答案 0 :(得分:0)
嗯,对于初学者来说,需要将#options转换为每个单选按钮的值。您也可能还需要为每个按钮添加标签。