我想在我的模块中添加单选按钮。如何使用添加单选按钮添加到hook_form?
答案 0 :(得分:1)
function mymodule_some_form($form_state) {
$form['radio'] = array(
'#type' => 'radios',
'#title' => 'Title',
'#options' => array(0 => 'First', 1 => 'Second', 3 => 'Third'),
'#attributes' => array('style' => 'display:inline-block;')
);
$form['select'] = array(
'#type' => 'select',
'#title' => 'Title',
'#options' => array(0 => 'First', 1 => 'Second', 3 => 'Third'),
'#attributes' => array('style' => 'display:inline-block;')
);
}
有关详细信息,请参阅Drupal FAPI Documentation。