Closed (fixed)
Project:
Geofield
Version:
7.x-1.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Jun 2012 at 13:55 UTC
Updated:
29 Jun 2013 at 00:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
ArchangelGuidz commentedWould like to report this is an issue too. Seems this was fixed for drawing features with OpenLayers, though not in the Geofield OL Map. I'm more of a designer than a JS-PHP guy. Can anyone help out on a fix?
Comment #2
phayes commentedI think we have this one fixed in the 2.x branch if you would like to check it out.
Comment #3
perkeJust upgraded from 7.x-1.1 to 7.x-2.x-dev and problem described above still appears.
Comment #4
phayes commented@perke,
What field settings are you using? Specifically, do you have "use collections" turned on or off?
Comment #5
perkehi,
storage options is set as "Store as a single collection"
here is screenshot of all settings for the geofield
thanks
Comment #6
perkeedit: here is better screenshot, overlay messed it up
Comment #7
Wouter Van den Bosch commentedI think this issue is related to this particular snippet of code in openlayers_behavior_geofield.js:
At that particular moment the Drupal.settings object does not exist, and hence the limitFeatures rule is ignored.
Commenting out the condition, results in one singular point being replaced on every click.
Comment #8
perkeI've tried commenting that out and it didn't worked. @Wouter, have you also upgraded from 7.x-1.1 or is it a clean install?
Comment #9
Wouter Van den Bosch commented@Perke, I had an install with 7.x-1.0 at first, which I later upgraded to 7.x-1.1. It's only after a while that i noticed that I was now selecting multiple points and that the number of values setting was being ignored.
So after some digging I briefly altered:
into:
Just to check whether that could be the problem of course. As soon as I comment out those two lines, I am back to the correct 1 point behaviour.
Do make sure to clear your cache though. I've had some issues with the old JS file hanging around.
Comment #10
perkeah ok, i was commenting full if statement... thanks, it worked... guess i'll use this temp fix to get this thing going on
Comment #11
phayes commentedThere should be no need to patch anything. If you are storing everything as a single collection, this is expected behavior. You should be using "Store each feature separately"
Comment #12
nubeli commentedNote that in the code "single" refers to "Store each feature separately" and "collection" to "Store as a single collection." That was a bit confusing.
I've got 7.x-1.1 on a site, it was not respecting 1 value for the field and it was set to Store each feature separately. I commented out the condition and it will now allow only one feature on the map. But it still ignores the value. For example, if I set it to 5 it will still only allow one feature on the map.
Comment #13
ressaThanks @Wouter Van den Bosch (#9) that works. The file in question is located here:
sites/all/modules/geofield/includes/behaviors/js/openlayers_behavior_geofield.js
Comment #14
gravisrs commentedAnother fix better than in #9 - earlier debug approach in file geofield.widgets.inc :
add a line like this:
please review and put fix to repo
Comment #15
Sinovchi commentedThanks gravisrs,
This is really better fix for 7.x-1.1.
Comment #16
Brandonian commented@gravisrs, can you make a patch for inclusion?
Comment #17
peterm95018 commentedHad the same issue, so I created (my first) patch based on gravisrs code in #14.
Peter
Comment #18
peterm95018 commentedComment #19
balagan commentedI came here from http://drupal.org/node/1630836#comment-6869276, which I think is a duplicate of this issue. I haven't reviewed this patch, but I have also found that the $setting variable is not available from the geofield_widget_openlayers_afterbuild function, and using dpm I saw that the value needed can be accessed in the $form_state variable. I will get back to this patch tomorrow
Comment #20
balagan commentedThe patch is working for me, but git produces a warning about whitespace error.
Comment #21
balagan commentedComment #22
balagan commentedComment #23
gerontas commentedI have tested the code in #14
It successfully limits the number of points that can be placed (1 in my case) but if the map is saved and then edited again, another point can be added and the original point cannot be deleted.
Comment #24
gerontas commentedSorry I spoke too soon - it looks as if it does work.
I discovered that I had 'Draw features' activated in the map behaviours settings. When I de-activated that the map respects the field setting.
Comment #25
shushu commentedPatch seems to work for me as well. Can this be pushed into the 1.x branch and closed ?
Comment #26
mr.baileysI ran into the same issue.
The bug was introduced in #1298842-4: Map is not rendered after validation error., where part of the behavior setup code was moved from
geofield_field_widget_formtogeofield_widget_openlayers_afterbuild. The snippet that was moved referenced a variable ($settings) that was not moved to the new function, and thus out of scope, always triggering the default data storage fallback value 'collection'.The patch in #17 works but seems fragile (for example, having the
'und'hardcoded.) Attached is a patch that usesfield_widget_instanceinstead.Comment #27
balagan commentedWell, it seems to be a lot nicer solution leaving out the 'und'.
Comment #28
organicwire commentedPatch #26 works for me.
Comment #29
Jarode commentedYes that works !
Comment #30
jcisio commentedI think it is important for the next release.
Comment #31
Brandonian commentedPatch at #26 applied. Thanks, @mr.baileys!
http://drupalcode.org/project/geofield.git/commit/39acd9e