I have a view that uses the GMap views style plugin. The data source for the marker is set to 'Geofield'. However the map does now show any markers. I get the following message:
Notice: Undefined index: geofield in gmap_plugin_style_gmap->render() (line 185 of .../gmap/gmap_plugin_style_gmap.inc).
I have managed to fix this by editing the next line:
$geofield_name = 'field_' . $this->options['geofield'];
And changing it into:
$geofield_name = 'field_' . $this->options['markerfield'];
After that change, the markers show up, but the bubbletext does not work. The following message appears:
Notice: Undefined variable: bubbletext_field_obj in gmap_plugin_style_gmap->render() (line 259 of ../gmap/gmap_plugin_style_gmap.inc).
I have managed to fix this by changing the next line:
if ($this->options['bubbletextenabled'] && !empty($bubbletext_field_alias) && !empty($row->{$bubbletext_field_alias})) {
Into:
if ($this->options['bubbletextenabled'] && !empty($this->options['bubbletextfield']) && !empty($this->rendered_fields[$row_index][$this->options['bubbletextfield']])) {
Apparantly the variable $bubbletext_field_alias does not exist and I assumed you want to check if the rendered_fields variable is not empty before rendering it?
Have there been changes to the module that could explain why my changes are necessary to get the GMap working with a Geofield datasource?
| Comment | File | Size | Author |
|---|---|---|---|
| #23 | gmap2_1907478_23_geofield.patch | 13.28 KB | johnv |
| #17 | gmap-revert_markerfield_to_geofield-1907478-16.patch | 684 bytes | marty2081 |
| #4 | gmap-marker_and_bubbletext-1907478-4.patch | 3.13 KB | marty2081 |
| #2 | gmap-bubbletext-1907478-1.patch | 909 bytes | Raphael Dürst |
Comments
Comment #1
podarokcan you provide a patch against latest dev for Your fix?
Comment #2
Raphael Dürst commentedI just had the same problem and made patch for 7.x-2.3.
Comment #3
marty2081 commentedSorry, I did not have time to create a patch so far.
I think the patch in #2 misses the first part of my changes?
Another reason why I didn't create a patch yet is that I'm not sure if my changes are a proper fix (it works in my case). So I was hoping someone would confirm that my changes are correct and then I would create a patch.
Comment #4
marty2081 commentedPatch attached (sorry, my patch also contains some space corrections due to sublime autocorrecting that):
Comment #5
marty2081 commentedComment #6
podarok#4 looks good
commited pushed to 7.x-2.x
Comment #7
podarokstatus
Comment #8
koppie commentedPatch works great. Any word on when we'll get it in a stable version?
Comment #9
podarok#8 its already in 7.x-2.4-beta1 version
Comment #10
johnvSorry for re-opening this, but Marty2081 seems to have his contact form disabled.
Martijn,
Can you tell me more about your Geofield configuration?
Your change broke mine...
see #1926360: Compatibility lost with Geofield (in gmap_plugin_style_gmap.inc).
I use Geofield 7.x-1.1, together with Addressfield, attached to nodes. I use Geocoder to code from Addressfield to Geofield.
Comment #11
marty2081 commented@johnv: off couse. It sucks that my patch breaks the functionality in your case :(
I also have an Addressfield that gets geocoded into a Geofield.
First the module versions:
GMap: 7.x-2.3-alpha3+0-dev (including my patch)
Geofield: 7.x-1.1
Geocoder: 7.x-1.2 (probably has nothing to do with this, but just to be sure)
I have a Geofield setup in a field collection with the following settings:
Widget: Geocode from another field
Geocode from field: Location data (addressfield field)
Geocoder: Google Geocoder
Geometry type: Point
Multivalue input handling: Match multiples
Comment #12
johnvSo, there shouldn't be a difference in module versions, and both our installations must be working fine in parallel.
Possible differences:
- naming of Geofield: mine is 'field_geo'. What's yours?
- is your entity a node, or a 'new ' entity ? Mine are nodes.
- my nodes are composed via Field UI completely. Yours?
- usage of field_collection: I have a node with fields: field_geo, field_addres + others. You have similar, bur wrapped in a field_collection?
I guess reversing the patched line will break your installation, even in 2.4?
Groeten, John
Comment #13
marty2081 commentedI updated to 7.x-2.4 and after that to 7.x-2.x-dev and the markers no longer show up on the map. However this is not because the markers are not set. When I print the $markers variable from within render() they are perfect including LAT/LON, etc.
When I print the $this->options I still have no $this->options['geofield']; this issue started out with and i DO have $this->options['markerfield'];
@johnv: when you print the options you do have a geofield within the options array?
Comment #14
marty2081 commented- The naming of the geofield in my case is: field_contact_geo_location
- My entity is a Field Collection. The field collection is setup as a multiple field within a node. (It is a field collection because there are more fields within the contact_info field collection and there are multple 'contacts' within the node
- My nodes and field collections are completely setup using the field UI (no custom coded fields)
- The Field Collection contains an addressfield, some textfields, a emailfield and a geofield.
Comment #15
marty2081 commentedIt turns out the issue with 7.x-2.4 is an issue with a wrong path to the gmap_markers.js file and has nothing to do with the patch for this issue. See #1929544: Fix for Relative Path from Root to gmap_markers.js to make Markers show.
Comment #16
marty2081 commentedToday I downloaded the latest dev-version and found out that when I re-save my map views I now get the 'geofield' property. Rolling back to the version I was using before and re-saving the views removes the property again. This means my previous patch can be reverted in the current 7.x-2.x-dev version.
A patch on the latest dev branch is following soon.
Comment #17
marty2081 commentedPatch attached.
Comment #18
johnv:-)
Comment #19
podarokok, pushed to 7.x-2.x-dev
this needs test coverage
Comment #20
podarok#17: gmap-revert_markerfield_to_geofield-1907478-16.patch queued for re-testing.
Comment #22
marty2081 commentedWhy was the version changed to 7.x-1.x? My issue (and supplied patches) are about the 7.x-2.x branch...
Comment #23
johnv@podarok,
Perhaps you should leave v1.x (Gmaps api v2) as is, and conentrate on v2.x (Gmaps api v3).
Please find attached a more performant version of geofield support.
I needed more time to do the same for
else if ($this->options['datasource'] == 'fields'), so that remains untouched.Comment #24
podarok#23 should be updated with removal changes from other issue patches )))
We can support 7.x-1.x with backporting to workflow
all patches create against 7.x-2.x and after fixing - backporting them to 7.x-1.xthis is a good practice for drupal core and we should follow it for the right release roadmaps
Comment #25
johnvForget #23, and since #17 is committed, this is fixed. It is not valid for 1.x, which is working fine.
Patch #23 is also contained in #1153032-19: Markers doesn't work in a view with the configuration: choose latitude and longitude fields.
Test for Geofield support will be included in #1934122: Gmap Views tests. Needs extending and fixing follow-ups.
Comment #26
podarokok, closed
following up