Skip to content
Snippets Groups Projects
Commit d9a7a684 authored by johnv's avatar johnv Committed by Andriy Podanenko
Browse files

Issue #1153032 by podarok, citlacom, johnv: Fixed Markers doesn't work in a...

Issue #1153032 by podarok, citlacom, johnv: Fixed Markers doesn't work in a view with the configuration: choose latitude and longitude fields.
parent 4534a421
No related branches found
No related tags found
No related merge requests found
...@@ -102,15 +102,13 @@ class gmap_plugin_style_gmap extends views_plugin_style { ...@@ -102,15 +102,13 @@ class gmap_plugin_style_gmap extends views_plugin_style {
$lon_field = 'gmap_lon'; $lon_field = 'gmap_lon';
} }
else if ($this->options['datasource'] == 'geofield') { else if ($this->options['datasource'] == 'geofield') {
$lat_field = 'lat'; $lat_field = 'field_' . $this->options['geofield']; // "[0]['raw']['lat']";
$lon_field = 'lon'; $lon_field = 'field_' . $this->options['geofield']; // "[0]['raw']['lon']";
} }
// Determine fieldname for latitude and longitude fields. // Determine fieldname for latitude and longitude fields.
else if ($this->options['datasource'] == 'fields') { else if ($this->options['datasource'] == 'fields') {
$lat_field_obj = $this->view->display_handler->get_handler('field', $this->options['latfield']); $lat_field = 'field_' . $this->options['latfield']; // "[0]['raw']['value']";
$lon_field_obj = $this->view->display_handler->get_handler('field', $this->options['lonfield']); $lon_field = 'field_' . $this->options['lonfield']; // "[0]['raw']['value']";
$lat_field = $lat_field_obj->field_alias;
$lon_field = $lon_field_obj->field_alias;
} }
// Determine fieldname for marker field. // Determine fieldname for marker field.
...@@ -179,23 +177,13 @@ class gmap_plugin_style_gmap extends views_plugin_style { ...@@ -179,23 +177,13 @@ class gmap_plugin_style_gmap extends views_plugin_style {
$lat = (float)$row->{$lat_field}; $lat = (float)$row->{$lat_field};
$lon = (float)$row->{$lon_field}; $lon = (float)$row->{$lon_field};
} }
else if ($this->options['datasource'] == 'geofield') { elseif ($this->options['datasource'] == 'geofield') {
$geofield_name = 'field_' . $this->options['geofield']; $lat = isset($row->{$lat_field}[0]['raw']['lat']) ? (float) $row->{$lat_field}[0]['raw']['lat'] : NULL;
$geofield = isset($row->{$geofield_name}[0]['raw']) ? $row->{$geofield_name}[0]['raw'] : NULL; $lon = isset($row->{$lon_field}[0]['raw']['lon']) ? (float) $row->{$lon_field}[0]['raw']['lon'] : NULL;
if ($geofield) {
$lat = (float)$geofield[$lat_field];
$lon = (float)$geofield[$lon_field];
}
} }
else if ($this->options['datasource'] == 'fields') { elseif ($this->options['datasource'] == 'fields') {
$custom_field_latname = 'field_' . $lat_field; $lat = isset($row->{$lat_field}[0]['raw']['value']) ? (float) $row->{$lat_field}[0]['raw']['value'] : NULL;
$custom_field_lonname = 'field_' . $lon_field; $lon = isset($row->{$lon_field}[0]['raw']['value']) ? (float) $row->{$lon_field}[0]['raw']['value'] : NULL;
$custom_field_lat = isset($row->{$custom_field_latname}[0]['raw']) ? $row->{$custom_field_latname}[0]['raw'] : NULL;
$custom_field_lon = isset($row->{$custom_field_lonname}[0]['raw']) ? $row->{$custom_field_lonname}[0]['raw'] : NULL;
if ($custom_field_lat && $custom_field_lon) {
$lat = (float)$row->{$lat_field};
$lon = (float)$row->{$lon_field};
}
} }
// $row->nid is present in node views, views without node as the base table must include the nid field, // $row->nid is present in node views, views without node as the base table must include the nid field,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment