theme_checkbox

  1. drupal
    1. 5
    2. 6
    3. 7
    4. 8
Versions
5 – 6 theme_checkbox($element)
8 – 7 theme_checkbox($variables)

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: #title, #value, #return_value, #description, #required, #attributes.

Related topics

Code

includes/form.inc, line 2972

<?php
function theme_checkbox($variables) {
  $element = $variables['element'];
  $t = get_t();
  $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']) . ' />';
}
?>