Drupal 7 Drupal 7挂钩菜单复选框问题

Drupal 7 Drupal 7挂钩菜单复选框问题,drupal-7,checkbox,hook-menu,Drupal 7,Checkbox,Hook Menu,我试图把一个模块,这将有它自己的配置页面。为此,我使用以下代码作为菜单页回调: function webform_customizations_customize() { $form = array(); // Text field for the e-mail subject. $form['webform_customizations']['user_warn_e-mail_subject'] = array( '#type' => 'textfiel

我试图把一个模块,这将有它自己的配置页面。为此,我使用以下代码作为菜单页回调:

function webform_customizations_customize() {
    $form = array();
  // Text field for the e-mail subject.
  $form['webform_customizations']['user_warn_e-mail_subject'] = array(

        '#type' => 'textfield',
        '#title' => t('Warning e-mail subject'),
        '#description' => t('The subject of the e-mail which will be sent 
    to users.'),
          '#size' => 40,
          '#maxlength' => 120,
          '#required' => TRUE,
    );
    $options = array('A', 'B', 'C');
    $form['test'] = array(
        '#type' => 'radios',
        '#options' => array(
                'one' => t('one'),
                'two' => t('two'),
            ),
        '#title' => t('roles that should see a minimal webforms setting area'),
        '#title_display' => t('testing'),
    );
  $form['high_school']['tests_taken'] = array(

    '#type' => 'checkboxes', 

    '#options' => drupal_map_assoc(array(t('SAT'), t('ACT'))), 
    '#title' => t('What standardized tests did you take?'),
    '#states' => array(
      'visible' => array(// action to take.
        ':input[name="student_type"]' => array('value' => 'high_school'),
      ),
    ),
  );
return $form;
}
我的问题是显示复选框的尝试失败。第一个字段成功显示文本字段。但接下来的两个复选框从未显示在我的配置页面上,测试复选框代码直接从中删除,没有任何修改


我尝试了一个复选框,但效果很好。

您应该已经阅读了代码附带的注释:

    // This #states rule says that this checkboxes array will be visible only
    // when $form['student_type'] is set to t('High School').
    // It uses the jQuery selector :input[name=student_type] to choose the
    // element which triggers the behavior, and then defines the "High School"
    // value as the one that triggers visibility. 
只需删除#states元素,它就会工作。 祝你快乐