function views_plugin_style_kml::map_rows in KML 6.2
Same name and namespace in other branches
- 7 views/views_plugin_style_kml.inc \views_plugin_style_kml::map_rows()
File
- views/
views_plugin_style_kml.inc, line 124 - Extending the view_plugin_style class to provide a kml view style.
Class
- views_plugin_style_kml
- @file Extending the view_plugin_style class to provide a kml view style.
Code
function map_rows($rows) {
// Fields must be rendered in order as of Views 2.3,
// so we will pre-render everything.
$renders = array();
$keys = array_keys($this->view->field);
foreach ($rows as $count => $row) {
foreach ($keys as $id) {
$renders[$count][$id] = $this->view->field[$id]
->theme($row);
}
}
$points = array();
foreach ($renders as $id => $row) {
$point = array();
foreach ($this->view->field as $key => $field) {
if ($key == $this->options['fields']['name']) {
$point['name'] = $row[$key];
}
elseif ($key == $this->options['fields']['description']) {
$point['description'] = $row[$key];
}
elseif ($key == $this->options['fields']['longitude']) {
$point['lon'] = $row[$key];
}
elseif ($key == $this->options['fields']['latitude']) {
$point['lat'] = $row[$key];
}
else {
$point['content'][$key] = $row[$key];
}
}
$point['point'] = $point['lon'] . ',' . $point['lat'] . ',0';
unset($point['lat']);
unset($point['lon']);
if ($this->options['linestring']['enable']) {
$points[$point['group']][] = $point;
}
else {
$points[] = $point;
}
}
return $points;
}