You are here

function template_preprocess_views_data_export_csv_header in Views data export 7

Same name and namespace in other branches
  1. 6.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv_header()
  2. 6 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv_header()
  3. 6.2 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv_header()
  4. 7.4 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv_header()
  5. 7.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv_header()

File

theme/views_data_export.theme.inc, line 73
Theme related functions for processing our output style plugins.

Code

function template_preprocess_views_data_export_csv_header(&$vars) {
  _views_data_export_header_shared_preprocess($vars);

  // Make sure we catch saved options that are misspelled. LEGACY
  if (isset($vars['options']['seperator'])) {
    $vars['options']['separator'] = $vars['options']['seperator'];
  }

  // Support old misspelled templates. LEGACY
  $vars['seperator'] = $vars['separator'] = $vars['options']['separator'];

  // Special handling when quoted values are involved.
  if ($vars['options']['quote']) {
    $wrap = '"';
    $replace_value = '""';
  }
  else {
    $wrap = '';
    $replace_value = '';
  }

  // Format header values.
  foreach ($vars['header'] as $key => $value) {
    $output = decode_entities(strip_tags($value));
    if ($vars['options']['trim']) {
      $output = trim($output);
    }
    $vars['header'][$key] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
  }
}