function template_preprocess_views_view_kml in KML 6.2
Same name and namespace in other branches
- 7 views/kml_views.theme.inc \template_preprocess_views_view_kml()
@file Theming functions for KML module views output.
File
- views/
kml_views.theme.inc, line 8 - Theming functions for KML module views output.
Code
function template_preprocess_views_view_kml(&$vars) {
$view = $vars['view'];
$points = $view->style_plugin
->map_rows($vars['rows']);
$style = theme('kml_style', $points);
foreach ($points as $point) {
$rows .= theme('kml_placemark', $point, $points);
}
$vars['rows'] = $rows;
$vars['style'] = $style;
$vars['viewtitle'] = $view
->get_title();
// Checks if filename is manually specified in view style options otherwise
// it sets it as the name of the view.
if (!empty($view->style_options['filename'])) {
$filename = $view->style_options['filename'] . '.kml';
}
else {
$filename = $vars['viewtitle'] . '.kml';
}
drupal_set_header('Content-Type: application/vnd.google-earth.kml+xml');
drupal_set_header("Content-Disposition: attachment; filename=\"{$filename}\"");
}