You are here

function _webform_csv_headers_grid in Webform 7.4

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. 6.2 components/grid.inc \_webform_csv_headers_grid()
  5. 7.3 components/grid.inc \_webform_csv_headers_grid()

Implements _webform_csv_headers_component().

File

components/grid.inc, line 597
Webform module grid component.

Code

function _webform_csv_headers_grid($component, $export_options) {
  $node = node_load($component['nid']);
  $items = _webform_select_options_from_text($component['extra']['questions'], TRUE);
  $items = _webform_select_replace_tokens($items, $node);
  $header = array();
  $header[0] = array(
    '',
  );
  $header[1] = array(
    $export_options['header_keys'] ? $component['form_key'] : $component['name'],
  );
  $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][] = $export_options['header_keys'] ? $key : _webform_grid_question_header($item);
    $count++;
  }
  return $header;
}