我正在尝试组合一个具有自己的配置页面的模块。为此,我使用以下代码作为我的菜单页面回调:
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;
}
我的问题是我尝试显示复选框失败了。第一个字段成功显示了一个文本字段。但是接下来的两个是从未在我的配置页面上显示的复选框 - 并且 tests_taken 复选框代码是直接从这个 drupal 文档页面中提取的,没有任何修改。
我尝试了一个复选框,并且有效。