1 form_test.module | form_test_checkboxes_zero($form, &$form_state, $json = TRUE) |
File
- core/
modules/ simpletest/ tests/ form_test.module, line 2561 - Helper module for the Form API tests.
Code
function form_test_checkboxes_zero($form, &$form_state, $json = TRUE) {
$form['checkbox_off'] = array(
'#type' => 'checkboxes',
'#options' => array('foo', 'bar', 'baz'),
);
$form['checkbox_zero_default'] = array(
'#type' => 'checkboxes',
'#options' => array('foo', 'bar', 'baz'),
'#default_value' => array(0),
);
$form['checkbox_string_zero_default'] = array(
'#type' => 'checkboxes',
'#options' => array('foo', 'bar', 'baz'),
'#default_value' => array('0'),
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save',
);
if ($json) {
$form['#submit'][] = '_form_test_submit_values_json';
}
else {
$form['#submit'][] = '_form_test_checkboxes_zero_no_redirect';
}
return $form;
}