function webform_expand_select_ids in Webform 7.3
Same name and namespace in other branches
- 6.3 components/select.inc \webform_expand_select_ids()
- 7.4 components/select.inc \webform_expand_select_ids()
FAPI process function to rename IDs attached to checkboxes and radios.
3 string references to 'webform_expand_select_ids'
- webform_expand_grid in components/
grid.inc - A Form API #process function for Webform grid fields.
- webform_expand_select_or_other in components/
select.inc - Process function to ensure select_or_other elements validate properly.
- _webform_render_select in components/
select.inc - Implements _webform_render_component().
File
- components/
select.inc, line 431 - Webform module multiple select component.
Code
function webform_expand_select_ids($element) {
$id = $element['#id'] = str_replace('_', '-', _webform_safe_name(strip_tags($element['#id'])));
$delta = 0;
foreach (element_children($element) as $key) {
$delta++;
// Convert the #id for each child to a safe name, regardless of key.
$element[$key]['#id'] = $id . '-' . $delta;
// Prevent scripts or CSS in the labels for each checkbox or radio.
$element[$key]['#title'] = _webform_filter_xss($element[$key]['#title']);
}
return $element;
}