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

Comments

levelos’s picture

Status: Active » Fixed

Thanks geoffreyr, patch committed with a couple of minor modifications in af7957098a7bc8c3a069e5c29e22bb4664cef971.

gcb’s picture

Status: Fixed » Closed (fixed)
jackbravo’s picture

Status: Closed (fixed) » Active

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

dddbbb’s picture

I'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

rdeboer’s picture

Hi @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

dddbbb’s picture

Thanks @RdeBoer.

Just updated to 7.x-1.2 and I'm still seeing the error. The line number is now 309.

dddbbb’s picture

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

  • RdeBoer committed b80eaec on 7.x-1.x
    [#2148003] Undefined index: title
    
rdeboer’s picture

Assigned: Unassigned » rdeboer
Status: Active » Fixed

Fixed in 7.x-1.x-dev. Will be included in next official release, which will be 7.x-1.3
Rik

dddbbb’s picture

Much appreciated :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.