You are here

function _webform_csv_data_select in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/select.inc \_webform_csv_data_select()
  2. 5 components/select.inc \_webform_csv_data_select()
  3. 6.3 components/select.inc \_webform_csv_data_select()
  4. 7.4 components/select.inc \_webform_csv_data_select()
  5. 7.3 components/select.inc \_webform_csv_data_select()

Return the result of a textfield submission. The output of this function will be displayed under the "results" tab then "submissions".

Parameters

$data: An array of information containing the submission result, directly correlating to the webform_submitted_data database schema.

Return value

Textual output formatted for CSV, not including either prefixed or trailing commas.

File

components/select.inc, line 455
Webform module multiple select component.

Code

function _webform_csv_data_select($data, $component) {
  $value = _webform_filter_values($component['value'], NULL, NULL, FALSE);
  $options = _webform_select_options($component['extra']['items'], TRUE);
  $return = array();
  if ($component['extra']['multiple']) {
    foreach ($options as $key => $item) {
      if (in_array($key, (array) $data['value']) === TRUE) {
        $return[] = 'X';
      }
      else {
        $return[] = '';
      }
    }
  }
  else {
    $return = $data['value'][0];
  }
  return $return;
}