function form_test_checkboxes_zero

1 string reference to 'form_test_checkboxes_zero'
form_test_menu in drupal/core/modules/system/tests/modules/form_test/form_test.module
Implements hook_menu().

File

drupal/core/modules/system/tests/modules/form_test/form_test.module, line 2302
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;
}