I upgraded from 1.0 to 1.1. Now I get the following error when trying to edit a field in my view's block display:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /admin/structure/views/ajax/config-item/locations/block_1/field/field_geocoded_address
StatusText: parsererror
ResponseText:
Fatal error: Unsupported operand types in /var/www/oppstarget/includes/form.inc on line 2637
At the same time I have a few interesting messages in watchdog:
442 30/Jan 17:06 php warning Warning: array_merge() [function.array-merge]: Argument #2 is
not an array in leaflet_form_elements() (line 591 of
/var/www/oppstarget/sites/all/modules/contrib/leaflet/leaflet.f
ormatters.
441 30/Jan 17:06 php notice Notice: Undefined variable: field_options in
leaflet_field_formatter_settings_form() (line 109 of
/var/www/oppstarget/sites/all/modules/contrib/leaflet/leaflet.f
ormatters.inc).
440 30/Jan 17:06 php warning Warning: Invalid argument supplied for foreach() in
leaflet_field_formatter_settings_form() (line 103 of
/var/www/oppstarget/sites/all/modules/contrib/leaflet/leaflet.f
ormatters.inc).
439 30/Jan 17:06 php notice Notice: Undefined index: #fields in
leaflet_field_formatter_settings_form() (line 103 of
/var/www/oppstarget/sites/all/modules/contrib/leaflet/leaflet.f
ormatters.inc).
The field in question is geocoded from another field. It works fine if I create a new view, add the relevant fields, and set the formatter to this field to something like Latitude/Longitude or WKT. As soon as I try and select the Leaflet formatter, I get the popup box with the Ajax error and then I'm unable to change it back. This is stopping me from upgrading from 1.0 unfortunately so I'd appreciate any ideas.
Using:
- Drupal 7.26
- Leaflet 1.1
- Leaflet library 0.7
- Geofield 2.1
- Addressfield 1.0-beta5
- Geocoder 1.2
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | Screen Shot 2014-03-18 at 14.14.41-unpatched.png | 113.07 KB | markgifford |
| #7 | Screen Shot 2014-03-18 at 14.17.22-patched.png | 104.61 KB | markgifford |
| #6 | field-formatter-errors-2185767-6.patch | 14 KB | briand44 |
| #4 | Screen Shot 2014-02-06 at 11.57.42.png | 54.69 KB | markgifford |
| #4 | Screen Shot 2014-02-06 at 11.57.29.png | 56.87 KB | markgifford |
Issue fork leaflet-2185767
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #1
cboyden commentedI am seeing this same error when trying to apply settings to a Leaflet-formatted Geofield with Panels and Panelizer.
And I am also seeing the exact same messages in the watchdog as markgifford.
Modules:
leaflet-7.x-1.1+1-dev
leaflet_markercluster-7.x-1.0-beta1+6-dev
panels-7.x-3.2+5-dev
panelizer-7.x-3.0-rc1
geofield-7.x-2.1
Libraries:
Leaflet 0.7.2
Latest version of Leaflet.markercluster
Comment #2
Freaka commentedHey,
Same error here and it's when I try to update a field in a view too :
Comment #3
markgifford commentedI had a bit of time to dig into this finally. It looks like the bug was introduced in this commit: http://drupalcode.org/project/leaflet.git/blobdiff/0f89272cd5aca5bbfea03...
The addition of
'#empty_option' => t('-- Select --'),to the "Marker Field" select element is a definite UI improvement when you're formatting the field directly attached to a node but it's what seems to be breaking things when the field formatter is being accessed in Views. Removing this line fixes things for me temporarily, and I'm able to use the latest dev.Looking at the relevant docs for Form API (https://api.drupal.org/api/drupal/developer!topics!forms_api_reference.h...), it says that use of this property depends on quite a few things related to the several possible #states of the select field. The states don't appear to be working correctly in Views UI at all (see screenshots), and I wonder if this is the real reason the addition of #empty_option broke the site. It was only when I accessed the field_formatter attached to a node that I noticed parts of the form are supposed to become visible and invisible depending on whether you select "Icon File" or "Field (html DivIcon)"
Comment #4
markgifford commentedComment #5
halloffame commented+1 to this. Commented out #empty_option bit fixed the problem.
Comment #6
briand44 commentedI think the reason the #empty_option is causing problems is not because of the #states not working but because #options is NULL in views ui and panels/page manager ui. Here is an attempt at a patch that just sets the select list options to an empty array in this case. We should figure out the correct way to set #options in these instances but for now this should get rid of the error. This patch also addresses the #states issue as well.
Comment #7
markgifford commented+1. I just applied the patch to latest dev. Patch applied cleanly, and seems to have fixed the issue. See screenshots. Thanks briand44
Comment #8
vlooivlerke commentedThanks, the patch in #6 works
Comment #9
bneil commentedSetting to RTBC based on comments in #7, #8 and I have also tested the patch.
Comment #10
socialnicheguru commentedthis works. RTBC
Comment #11
juzzuu commentedAfter 3 days of trying to make this work in Panels and Views, yes! Many thanks. The patch in #6 works great.
Comment #12
miromarchi commentedI added "panel" to the title for issue search improvement. #6 works for me too, thanks!
Comment #13
Helrunar commentedPatch in #6 works fine for me.
Comment #14
Helrunar commentedPatch in #6 is working fine for me, too.
Comment #15
nattyweb commentedGreat stuff - #6 worked for me; used on current dev version of Leaflet (7.x-1.x-dev, 2014-Oct-05). Thank you and please can we get this committed to save others having to hunt down the problem?!
Comment #16
sja1 commentedPatch #6 fixed the problem for me.
Comment #17
ergophobe commentedNumber 6 fixed this issue for me as well.
Comment #18
barwonhack commentedKudos and thanks for Patch #6.
Perhaps a module maintainer could commit release?
Comment #19
jweirather commentedYes, kudos and thank you for the clear (keyword rich, top search result) documentation of the error, and for the fix.
The patch in #6 worked beautifully for me.
Applied patch and reflexively cleared cache.
Comment #20
MatthewHager commentedPatch is working for us.
Comment #21
n20 commented#6 worked for me initially. For some reason notices and warnings came back:
Notice: Undefined index: #fields in leaflet_field_formatter_settings_form() (line 103 of...Warning: Invalid argument supplied for foreach() in leaflet_field_formatter_settings_form() (line 103...Notice: Undefined variable: field_options in leaflet_field_formatter_settings_form() (line 109...i looked at $form and there is no $form['#fields']:
Comment #22
astringer commentedThe patch cleared the ajax error for me, but I'm getting the same errors as N20 above. Is this the same issue the patch in #6 addressed?
Comment #23
barwonhack commentedSwitch to ip_geoloc module.
Comment #24
astringer commentedThanks, adding the ip_geoloc module fixed it.
Comment #25
rdeboerYay :-)
Comment #26
guypaddock commented#6 worked for me.
Comment #27
socialnicheguru commentedDoes this fix issue solve this:
https://www.drupal.org/node/1796656
Comment #28
nwom commentedThe newest dev includes #1796656: Selecting Leaflet field formatter in a Leaflet Map Views display breaks things greatly, which fixes this issue as well. The patch in this thread is no longer needed.
I tested by first applying the patch in this thread using the prior dev, which solved the issue. Then I used the newest dev, and this patch was no longer necessary.
I'm fairly certain that we can close this thread.
Comment #29
nwom commentedComment #30
rdeboerThanks for confirming @NWOM.
Gives us confidence about making dev the new official release.
Rik
Comment #31
vagelis-prokopiou commentedI had the same issue in views, and I 'solved' it by using another formatter, that is 'Geofield Map'. There is a module with the same name that you must enable first.
Comment #32
pyxio commentedthis issue appears to be back in 7.x-1.4 and 7.x-1.x-dev
Comment #33
gemp commentedIt's back in 7.x-1.4 (dev is identical). It doesn't cause Ajax havoc but no option set on the marker is taken into account.
Errors in the log for leaflet.formatters.inc:
I applied the #6 patch (to no avail), so line numbers may vary.
Drupal 7.59
Views 7.x-3.20