function webform_expand_checkboxes in Webform 6.2
Same name and namespace in other branches
- 5.2 components/select.inc \webform_expand_checkboxes()
- 6.3 components/select.inc \webform_expand_checkboxes()
Drupal 6 hack that properly *renders* checkboxes in multistep forms. This is different than the value hack needed in Drupal 5, which is no longer needed.
1 string reference to 'webform_expand_checkboxes'
- _webform_render_select in components/
select.inc - Build a form item array containing all the properties of this component.
File
- components/
select.inc, line 200 - Webform module multiple select component.
Code
function webform_expand_checkboxes($element) {
// Elements that have a value set are already in the form structure cause
// them not to be written when the expand_checkboxes function is called.
$default_value = array();
foreach (element_children($element) as $key) {
if (isset($element[$key]['#default_value'])) {
$default_value[$key] = $element[$key]['#default_value'];
unset($element[$key]);
}
}
$element = expand_checkboxes($element);
foreach ($default_value as $key => $val) {
$element[$key]['#default_value'] = $val;
}
return $element;
}