You are here

function _webform_submit_select in Webform 5.2

Same name and namespace in other branches
  1. 5 components/select.inc \_webform_submit_select()
  2. 6.3 components/select.inc \_webform_submit_select()
  3. 6.2 components/select.inc \_webform_submit_select()
  4. 7.4 components/select.inc \_webform_submit_select()
  5. 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 260
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]);
      }
    }
  }
}