I have got a Leaflet map working with point or multipoint markers through a geofield with wkt input and leaflet formatter.

I would like to be able to program the popups with text that is specific to the point displayed with the marker, but as far as I can see the popup text is only editable in the "Manage Display" section for the map field as a whole? Is there any way around this or is it a limitation in the current Drupal implementation of Leaflet?

Thanks

CommentFileSizeAuthor
#4 leaflet-alter-settings-2622032-4.patch756 bytesgifad
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bogzab created an issue. See original summary.

robertwb’s picture

This can be accomplished through the Leaflet Views display type. If you create a view of your content with a geofield or even just a wkt text field the display settings will then ask for views fields to supply label and description for your shapes. A piece of cake.

gifad’s picture

If by "I would like to be able to program..." you mean that you are a programmer, you can implement hook_leaflet_map_prebuild_alter, and customize $settings['features'][$index]['popup'] (assuming you setup a custom token in the "Manage display" settings).

Otherwise, leaflet views allow setting popup content to any view field, including rendered entity in any view mode...

[Edit: typed before #2 show...]

gifad’s picture

Category: Support request » Feature request
Status: Active » Needs review
FileSize
756 bytes

BTW, the hook_leaflet_map_settings() introduced by this patch allows other modules to add/customize settings/features depending on runtime conditions in a more efficient/reliable way...

bogzab’s picture

Thanks for the helpful comments posted in response to my request. I will have a go with leaflet views first - I had come to the conclusion that Views was probably at least part of the answer.

RdeBoer’s picture

Also try, in addition to your current Leaflet set-up, without needing to change much, http://drupal.org/project/ip_geoloc (shameless plug)

Sam152’s picture