Skip to content
Snippets Groups Projects
Commit 31d6aaf9 authored by oxyc's avatar oxyc Committed by podarok
Browse files

Issue #1969214 by oxyc: Added support for geolocation module.

parent a779c175
No related branches found
Tags 7.x-2.7-beta2
No related merge requests found
......@@ -107,6 +107,10 @@ class gmap_plugin_style_gmap extends views_plugin_style {
$lat_field = 'field_' . $this->options['geofield']; // "[0]['raw']['lat']";
$lon_field = 'field_' . $this->options['geofield']; // "[0]['raw']['lon']";
}
else if ($this->options['datasource'] == 'geolocation') {
$lat_field = 'field_' . $this->options['geolocation']; // "[0]['raw']['lat']";
$lon_field = 'field_' . $this->options['geolocation']; // "[0]['raw']['lng']";
}
// Determine fieldname for latitude and longitude fields.
else if ($this->options['datasource'] == 'fields') {
$lat_field = 'field_' . $this->options['latfield']; // "[0]['raw']['value']";
......@@ -182,6 +186,10 @@ class gmap_plugin_style_gmap extends views_plugin_style {
$lat = isset($row->{$lat_field}[0]['raw']['lat']) ? (float) $row->{$lat_field}[0]['raw']['lat'] : NULL;
$lon = isset($row->{$lon_field}[0]['raw']['lon']) ? (float) $row->{$lon_field}[0]['raw']['lon'] : NULL;
}
elseif ($this->options['datasource'] == 'geolocation') {
$lat = isset($row->{$lat_field}[0]['raw']['lat']) ? (float) $row->{$lat_field}[0]['raw']['lat'] : NULL;
$lon = isset($row->{$lon_field}[0]['raw']['lng']) ? (float) $row->{$lon_field}[0]['raw']['lng'] : NULL;
}
elseif ($this->options['datasource'] == 'fields') {
$lat = isset($row->{$lat_field}[0]['raw']['value']) ? (float) $row->{$lat_field}[0]['raw']['value'] : NULL;
$lon = isset($row->{$lon_field}[0]['raw']['value']) ? (float) $row->{$lon_field}[0]['raw']['value'] : NULL;
......@@ -335,6 +343,7 @@ class gmap_plugin_style_gmap extends views_plugin_style {
'#options' => array(
'location' => t('Location.module'),
'geofield' => t('Geofield.module'),
'geolocation' => t('Geolocation.module'),
'fields' => t('Choose latitude and longitude fields'),
//'geocode' => t('Just-in-time geocoding on field named "address"'),
),
......@@ -372,6 +381,16 @@ class gmap_plugin_style_gmap extends views_plugin_style {
'#dependency' => array('edit-style-options-datasource' => array('geofield')),
);
$form['geolocation'] = array(
'#title' => t('Geolocation field'),
'#description' => t('Select the Geolocation source field.'),
'#type' => 'select',
'#options' => $field_options,
'#default_value' => isset($this->options['geolocation']) ? $this->options['geolocation'] : NULL,
'#process' => array('ctools_dependent_process'),
'#dependency' => array('edit-style-options-datasource' => array('geolocation')),
);
$form['markers'] = array(
'#type' => 'select',
'#title' => t('Marker handling'),
......
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