On this page
function theme_checkbox
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: #id, #name, #attributes, #checked, #return_value.
Related topics
File
- includes/form.inc, line 3221
- 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']) . ' />';
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/includes!form.inc/function/theme_checkbox/7.x