function _webform_csv_headers_grid in Webform 5
Same name and namespace in other branches
- 5.2 components/grid.inc \_webform_csv_headers_grid()
- 6.3 components/grid.inc \_webform_csv_headers_grid()
- 6.2 components/grid.inc \_webform_csv_headers_grid()
- 7.4 components/grid.inc \_webform_csv_headers_grid()
- 7.3 components/grid.inc \_webform_csv_headers_grid()
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/
grid.inc, line 317
Code
function _webform_csv_headers_grid($component) {
$header = array();
$header[0] = '';
$header[1] = $component['name'];
$items = split("\n", $component['extra']['questions']);
foreach ($items as $item) {
$header[2] .= "\\," . $item;
// Empty column per sub-field in main header.
$header[1] .= "\\,";
}
// Remove the preceding extra comma.
$header[2] = substr($header[2], 2);
// Remove the trailing column.
$header[1] = substr($header[1], 0, -2);
return $header;
}