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).

CommentFileSizeAuthor
#2 gmap_1926360_2_geofield.patch684 bytesjohnv

Comments

johnv’s picture

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)

        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];
          }
        }

johnv’s picture

StatusFileSize
new684 bytes

faster then expected, see attached patch.

Status: Needs review » Needs work

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

johnv’s picture

Status: Needs work » Needs review

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

podarok’s picture

Version: 7.x-2.4-beta1 » 7.x-2.x-dev
Status: Needs review » Needs work
Issue tags: +Needs tests

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?

johnv’s picture

Status: Needs work » Needs review

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

johnv’s picture

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?

podarok’s picture

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

podarok’s picture

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

johnv’s picture

podarok’s picture

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

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

if geofield - use geofiled )))

podarok’s picture

as for me - this workaround needs tests for better checking

johnv’s picture

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};
podarok’s picture

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

podarok’s picture

#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

johnv’s picture

Status: Needs review » Closed (duplicate)