function form_test_checkboxes_zero in Drupal 7
1 string reference to 'form_test_checkboxes_zero'
- form_test_menu in modules/
simpletest/ tests/ form_test.module - Implements hook_menu().
File
- modules/
simpletest/ tests/ form_test.module, line 1962 - 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_checkbox_submit';
}
else {
$form['#submit'][] = '_form_test_checkboxes_zero_no_redirect';
}
return $form;
}