function _webform_render_boolean in Webform Boolean 7
Implements _webform_render_component().
File
- components/
boolean.inc, line 31 - A boolean field for webform.
Code
function _webform_render_boolean($component, $value = NULL) {
$element = array(
'#type' => 'checkbox',
'#title' => _webform_filter_xss($component['name']),
'#title_display' => $component['extra']['title_display'] ? $component['extra']['title_display'] : 'before',
'#default_value' => _webform_filter_xss($component['value']),
'#description' => _webform_filter_descriptions($component['extra']['description']),
'#required' => $component['mandatory'],
'#weight' => $component['weight'],
'#field_prefix' => empty($component['extra']['field_prefix']) ? NULL : _webform_filter_xss($component['extra']['field_prefix']),
'#field_suffix' => empty($component['extra']['field_suffix']) ? NULL : _webform_filter_xss($component['extra']['field_suffix']),
'#theme_wrappers' => array(
'checkbox',
'webform_element',
),
'#translatable' => array(
'title',
'description',
),
);
if (isset($value)) {
$element['#default_value'] = $value[0];
}
return $element;
}