function theme_checkbox

Returns HTML for a checkbox form element.


$variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #id, #name, #attributes, #checked, #return_value.

Related topics

1 theme call to theme_checkbox()
system_element_info in modules/system/system.module
Implements hook_element_info().


includes/, line 3238


function theme_checkbox($variables) {
    $element = $variables['element'];
    $element['#attributes']['type'] = 'checkbox';
    element_set_attributes($element, array(
        '#return_value' => 'value',
    // Unchecked checkbox has #value of integer 0.
    if (!empty($element['#checked'])) {
        $element['#attributes']['checked'] = 'checked';
    _form_set_class($element, array(
    return '<input' . drupal_attributes($element['#attributes']) . ' />';

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