function theme_checkbox

7.x form.inc theme_checkbox($variables)
5.x form.inc theme_checkbox($element)
6.x form.inc theme_checkbox($element)

Returns HTML for a checkbox form element.

Parameters

$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

90 string references to the theme hook from theme_checkbox()

Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.

AJAXFormValuesTestCase::testSimpleAJAXFormValue in drupal/modules/simpletest/tests/ajax.test
Create a simple form, then POST to system/ajax to change to it.
ajax_forms_test_lazy_load_form in drupal/modules/simpletest/tests/ajax_forms_test.module
Form builder: Builds a form that triggers a simple AJAX callback.
ajax_forms_test_simple_form in drupal/modules/simpletest/tests/ajax_forms_test.module
A basic form used to test form_state['values'] during callback.
ajax_forms_test_simple_form_checkbox_callback in drupal/modules/simpletest/tests/ajax_forms_test.module
Ajax callback triggered by checkbox.
ajax_pre_render_element in drupal/includes/ajax.inc
Adds Ajax information about an element to communicate with JavaScript.

... See full list

File

drupal/includes/form.inc, line 3133
Functions for form and batch generation and processing.

Code

function theme_checkbox($variables) {
  $element = $variables['element'];
  $element['#attributes']['type'] = 'checkbox';
  element_set_attributes($element, array('id', 'name','#return_value' => 'value'));

  // Unchecked checkbox has #value of integer 0.
  if (!empty($element['#checked'])) {
    $element['#attributes']['checked'] = 'checked';
  }
  _form_set_class($element, array('form-checkbox'));

  return '<input' . drupal_attributes($element['#attributes']) . ' />';
}