function template_preprocess_views_data_export_csv in Views data export 6.2
Same name and namespace in other branches
- 6.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv()
- 6 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv()
- 7.4 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv()
- 7 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv()
- 7.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_csv()
Preprocess csv output template.
File
- theme/
views_data_export.theme.inc, line 180 - Theme related functions for processing our output style plugins.
Code
function template_preprocess_views_data_export_csv(&$vars) {
// TODO Replace items with themed_rows.
_views_data_export_shared_preprocess($vars);
// Make sure we catch saved options that are misspelled. LEGACY
if (isset($vars['options']['separator'])) {
$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);
}
if (!empty($vars['options']['encoding']) && function_exists('iconv')) {
switch ($vars['options']['encoding']) {
case 'ASCII':
$converted = iconv("UTF-8", "ASCII//TRANSLIT", $output);
if ($converted !== FALSE) {
$output = $converted;
}
break;
}
}
$vars['header'][$key] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
}
// Format row values.
foreach ($vars['themed_rows'] as $i => $values) {
foreach ($values as $j => $value) {
$output = decode_entities(strip_tags($value));
if ($vars['options']['trim']) {
$output = trim($output);
}
if (!empty($vars['options']['encoding']) && function_exists('iconv')) {
switch ($vars['options']['encoding']) {
case 'ASCII':
$converted = iconv("UTF-8", "ASCII//TRANSLIT", $output);
if ($converted !== FALSE) {
$output = $converted;
}
break;
}
}
$vars['themed_rows'][$i][$j] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
}
}
}