views-views-geojson-style.tpl.php in Views GeoJSON 6
File
views/views-views-geojson-style.tpl.php
View source
<?php
$options = $view['options'];
$features = $view['features'];
$jsonp_prefix = $options['jsonp_prefix'];
$features_collection = array(
'type' => 'FeatureCollection',
'features' => $features,
);
if ($view->override_path) {
$json = _views_geojson_encode_formatted($features_collection);
if ($jsonp_prefix) {
$json = "{$jsonp_prefix}({$json})";
}
print "<code>{$json}</code>";
}
else {
$json = drupal_json($features_collection);
if ($jsonp_prefix) {
$json = "{$jsonp_prefix}({$json})";
}
if ($options['using_views_api_mode']) {
print $json;
}
else {
$content_type = $options['content_type'] == 'default' ? 'application/json' : $options['content_type'];
drupal_set_header("Content-Type: {$content_type}; charset=utf-8");
print $json;
exit;
}
}