Download & Extend

Compatibility lost with Geofield (in gmap_plugin_style_gmap.inc).

Project:GMap Module
Version:7.x-2.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)
Issue tags:Needs tests

Issue Summary

I upgraded from v1.1. to v2.4, using Geofield (not Location). It seems Geofield support is lost.
The existing Gmap views and a newly created view do not show any maps, and also the following error:
"Notice: Undefined index: geofield in gmap_plugin_style_gmap->options_form() (line 376 of gmap_plugin_style_gmap.inc).

Comments

#1

Title:Notice: Undefined index: geofield in gmap_plugin_style_gmap->options_form() (line 376 of gmap_plugin_style_gmap.inc).» Compatibility lost with Geofield (in gmap_plugin_style_gmap.inc).
Status:active» needs review

Below correction makes the geofield-markers appear again.
(I'll post a proper patch once the 2.4 version is workin om my system)

<?php
       
else if ($this->options['datasource'] == 'geofield') {
+         
$geofield_name = 'field_' . $this->options['geofield'];
-          
$geofield_name = 'field_' . $this->options['markerfield'];
         
$geofield = isset($row->{$geofield_name}[0]['raw']) ? $row->{$geofield_name}[0]['raw'] : NULL;
          if (
$geofield) {
           
$lat = (float)$geofield[$lat_field];
           
$lon = (float)$geofield[$lon_field];
          }
        }
?>

#2

faster then expected, see attached patch.

AttachmentSizeStatusTest resultOperations
gmap_1926360_2_geofield.patch684 bytesIdlePASSED: [[SimpleTest]]: [MySQL] 122 pass(es).View details | Re-test

#3

Status:needs review» needs work

The last submitted patch, gmap_1926360_2_geofield.patch, failed testing.

#4

Status:needs work» needs review

#2: gmap_1926360_2_geofield.patch queued for re-testing.

#5

Version:7.x-2.4-beta1» 7.x-2.x-dev
Status:needs review» needs work

looks like tests are old

possibly we should check with http://php.net/manual/en/function.array-key-exists.php for compatibility with legacy geofild versions?

#6

Status:needs work» needs review

#2: gmap_1926360_2_geofield.patch queued for re-testing.

#7

Regarding #5, I do not know what you mean. Was there a change in the geofield definition?
The patch sets 2.4 back to 1.1, so apparently there was some reason in the first place to change it?

#8

the change was done in #1907478-4: Gmap gmap style views plugin using non-existing property geofield
looks like some kind off crossbug?

#9

2 #7
my proposal is to code some kind of array key checking before assigning data to $geofield_name for avabiality of field data

#10

#11

looks like Your path from #2 good despite proposed #1907478: Gmap gmap style views plugin using non-existing property geofield due to

<?php
else if ($this->options['datasource'] == 'geofield') {
         
$geofield_name = 'field_' . $this->options['geofield'];
?>

if geofield - use geofiled )))

#12

as for me - this workaround needs tests for better checking

#13

ja, there are 2 parts "if ($this->options['datasource']" in render().
They can be merged, so the 2nd part can be just :

   $lat = (float)$row->{$lat_field};
   $lon = (float)$row->{$lon_field};

#14

#2: gmap_1926360_2_geofield.patch queued for re-testing.

#15

#13 Can You reproduce a bug with tests?
FYI Look at the http://drupalcode.org/project/gmap.git/blob/HEAD:/tests/gmap.test as example

#16

Status:needs review» closed (duplicate)

OK, thisis resolved, now that #1907478: Gmap gmap style views plugin using non-existing property geofield is reversed.