Spotted some error messages being triggered by leaflet_views when I wasn't using a rendered entity in my view. These errors were running along the lines of the following:
Notice: Undefined variable: entity in leaflet_views_plugin_style->render() (line 262 of /path/to/site/sites/all/modules/contrib/leaflet/leaflet_views/leaflet_views_plugin_style.inc).
Have attached a patch against 7.x-1.x-dev that should rectify this. It just adds a few extra checks to see if $entity is being populated, so that PHP's clumsy array handling doesn't keep making a mess.
(Would also like to give props – this looks like a really neat mapping library you've found, and done a great job on the integration so far. Very easy to get up and running. Am going to try and to see if I can use it to embed custom tilesets so people can have zoomable images and custom maps.)
| Comment | File | Size | Author |
|---|---|---|---|
| patch-leaflet-undefined-variable-entity.patch | 1.9 KB | geoffreyr |
Comments
Comment #1
levelos commentedThanks geoffreyr, patch committed with a couple of minor modifications in af7957098a7bc8c3a069e5c29e22bb4664cef971.
Comment #2
gcbhttps://drupal.org/node/2148175
Comment #3
jackbravo commentedThis still happens in Leaflet 1.1. I'm using a leaflet attachment view. The primary view uses fields and I get this error:
Notice: Undefined index: entity in leaflet_apply_map_settings() (line 400 of /var/aegir/other-sites/transportation.mediumbold.com/drupal/sites/all/modules/contrib/leaflet/leaflet.formatters.inc).The proposed patch solves the warning, but the map still does not show up.
Comment #4
dddbbb commentedI'm also getting a similar error when using a Leaflet attachment view:
Notice: Undefined index: title in leaflet_views_plugin_style->render() (line 262 of /var/www/site/docroot/sites/all/modules/contrib/leaflet/leaflet_views/leaflet_views_plugin_style.inc).Everything appears to be working OK but the nagging notice is consistent.
Leaflet 7.x-1.1
Comment #5
rdeboerHi @danbohea,
Thanks for reporting.
There have been many changes checked into the 7.x-1.x-dev version.
Can you please try it and if the problem still occurs quote the line number (which will be different from above).
Then I'll have a look and fix it.
Thank you
Best,
Rik
Comment #6
dddbbb commentedThanks @RdeBoer.
Just updated to 7.x-1.2 and I'm still seeing the error. The line number is now 309.
Comment #7
dddbbb commentedFull error, updated for anyone searching on that:
Notice: Undefined index: title in leaflet_views_plugin_style->render() (line 309 of /var/www/site/docroot/sites/all/modules/contrib/leaflet/leaflet_views/leaflet_views_plugin_style.inc).Comment #9
rdeboerFixed in 7.x-1.x-dev. Will be included in next official release, which will be 7.x-1.3
Rik
Comment #10
dddbbb commentedMuch appreciated :)