You are here

function _webform_csv_headers_grid in Webform 6.2

Same name and namespace in other branches
  1. 5.2 components/grid.inc \_webform_csv_headers_grid()
  2. 5 components/grid.inc \_webform_csv_headers_grid()
  3. 6.3 components/grid.inc \_webform_csv_headers_grid()
  4. 7.4 components/grid.inc \_webform_csv_headers_grid()
  5. 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 336
Webform module grid component.

Code

function _webform_csv_headers_grid($component) {
  $header = array();
  $header[0] = array(
    '',
  );
  $header[1] = array(
    $component['name'],
  );
  $items = _webform_grid_options($component['extra']['questions']);
  $count = 0;
  foreach ($items as $key => $item) {

    // Empty column per sub-field in main header.
    if ($count != 0) {
      $header[0][] = '';
      $header[1][] = '';
    }

    // The value for this option.
    $header[2][] = $item;
    $count++;
  }
  return $header;
}