function form_test_checkboxes_zero

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

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.