Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment | File | Size | Author |
---|---|---|---|
#4 | leaflet-alter-settings-2622032-4.patch | 756 bytes | gifad |
Comments
Comment #2
robertwb CreditAttribution: robertwb commentedThis 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.
Comment #3
gifad CreditAttribution: gifad commentedIf 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...]
Comment #4
gifad CreditAttribution: gifad commentedBTW, 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...Comment #5
bogzab CreditAttribution: bogzab commentedThanks 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.
Comment #6
RdeBoerAlso try, in addition to your current Leaflet set-up, without needing to change much, http://drupal.org/project/ip_geoloc (shameless plug)
Comment #7
Sam152 CreditAttribution: Sam152 as a volunteer and at PreviousNext commentedFYI https://www.drupal.org/node/2630752#comment-10647470