function webform_expand_checkboxes_image in Webform Select Image 7
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_image'
- _webform_render_select_image in components/
select_image.inc - Implements _webform_render_component().
File
- components/
select_image.inc, line 304 - Webform select image module select image component.
Code
function webform_expand_checkboxes_image($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 = form_process_checkboxes($element);
// Escape the values of checkboxes.
foreach (element_children($element) as $key) {
$element[$key]['#return_value'] = check_plain($element[$key]['#return_value']);
$element[$key]['#name'] = $element['#name'] . '[' . $element[$key]['#return_value'] . ']';
}
foreach ($default_value as $key => $val) {
$element[$key]['#default_value'] = $val;
}
return $element;
}