将radiobutton添加到hook_form

时间:2011-10-14 12:54:22

标签: php drupal drupal-6 drupal-modules drupal-views

我想在我的模块中添加单选按钮。如何使用添加单选按钮添加到hook_form?

1 个答案:

答案 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