function _webform_csv_headers_select in Webform 5.2
Same name and namespace in other branches
- 5 components/select.inc \_webform_csv_headers_select()
- 6.3 components/select.inc \_webform_csv_headers_select()
- 6.2 components/select.inc \_webform_csv_headers_select()
- 7.4 components/select.inc \_webform_csv_headers_select()
- 7.3 components/select.inc \_webform_csv_headers_select()
Return the header information for this component to be displayed in a comma seperated value file. The output of this function will be displayed under the "results" tab then "download".
Parameters
$component: An array of information describing the component, directly correlating to the webform_component database schema.
Return value
An array of data to be displayed in the first three rows of a CSV file, not including either prefixed or trailing commas.
File
- components/
select.inc, line 400 - Webform module multiple select component.
Code
function _webform_csv_headers_select($component) {
$headers = array(
0 => array(),
1 => array(),
2 => array(),
);
if ($component['extra']['multiple']) {
$headers[0][] = '';
$headers[1][] = $component['name'];
$items = _webform_select_options($component['extra']['items'], TRUE);
$count = 0;
foreach ($items as $key => $item) {
// Empty column per sub-field in main header.
if ($count != 0) {
$headers[0][] = '';
$headers[1][] = '';
}
$headers[2][] = $key;
$count++;
}
}
else {
$headers[0][] = '';
$headers[1][] = '';
$headers[2][] = $component['name'];
}
return $headers;
}