theme_checkbox($element)
drupal/includes/form.inc, line 940
Format a checkbox.
$element An associative array containing the properties of the element. Properties used: title, value, return_value, description, required
A themed HTML string representing the checkbox.
| Name | Description |
|---|---|
| Form generation | Functions to enable output of HTML forms and form elements. |
function theme_checkbox($element) {
_form_set_class($element, array('form-checkbox'));
$checkbox = '<input ';
$checkbox .= 'type="checkbox" ';
$checkbox .= 'name="'. $element['#name'] .'" ';
$checkbox .= 'id="'. $element['#id'].'" ' ;
$checkbox .= 'value="'. $element['#return_value'] .'" ';
$checkbox .= $element['#value'] ? ' checked="checked" ' : ' ';
$checkbox .= drupal_attributes($element['#attributes']) . ' />';
if (!is_null($element['#title'])) {
$checkbox = '<label class="option">'. $checkbox .' '. $element['#title'] .'</label>';
}
return theme('form_element', NULL, $checkbox, $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}