function _webform_submit_select in Webform 6.2
Same name and namespace in other branches
- 5.2 components/select.inc \_webform_submit_select()
- 5 components/select.inc \_webform_submit_select()
- 6.3 components/select.inc \_webform_submit_select()
- 7.4 components/select.inc \_webform_submit_select()
- 7.3 components/select.inc \_webform_submit_select()
Convert FAPI 0/1 values into something saveable.
Parameters
$data: The POST data associated with the component.
$component: An array of information describing the component, directly correlating to the webform_component database schema.
Return value
Nothing.
File
- components/
select.inc, line 264 - Webform module multiple select component.
Code
function _webform_submit_select(&$data, $component) {
$options = drupal_map_assoc(array_flip(_webform_select_options($component['extra']['items'], TRUE)));
if (is_array($data)) {
foreach ($data as $key => $value) {
if ($value != '') {
$data[$key] = $options[$key];
}
elseif ($value == 0 && $component['extra']['aslist'] !== 'Y' && $component['extra']['multiple'] === 'Y') {
unset($data[$key]);
}
else {
unset($data[$key]);
}
}
}
}