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