Is it possible to add a marker popup with text when using the form formatter (Leaflet Map Default)

Created on 23 October 2024, 5 months ago

Problem/Motivation

Hello, i'm currently using this awesome module and it's really nice. Thank you!

The only feature that I miss / can't find is how to add marker popup data (preferably text) when using the form formatter (Leaflet Map Default).

Now I can add markers (without data / pop-up info), polygons, lines, etc.

How can this be achieved, can anyone put me in the right direction?

Thanks in advance!

💬 Support request
Status

Active

Version

10.2

Component

Code

Created by

🇧🇪Belgium f0ns

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @f0ns
  • 🇮🇹Italy itamair

    May be you are a bit confused between what is a Formatter (that is the way fields are shown in the FE) and what is a Widget (that represents how a field is managed / setup in the BE), in the Drupal conventions.
    You mention you want to accomplish the Popup in the Leaflet Formatter, BUT you post the screenshot of the (Leaflet Map (default) Widget instead.

    Thus, please move away from the "Manage Form Display" TAB (that manages fields widgets), and rather move to the "Manage Display" TAB (that manages fields formatters) and there configure properly the Leaflet Map Formatter, also with the Leaflet Popup section / option, that supports "Replacements Patterns" (@see the attached screenshot).

    Keep in mind that same Leaflet Popup section / option is also available into the Leaflet Map View settings (with Tokens support).

  • 🇧🇪Belgium f0ns

    Thank you for your answers, I was indeed referring to the widget (and not the formatter) my bad.

    As I can see now there is no default way to drop a marker on the map and add some text to the pop-up in the widget.

    I guess the only way to get around this for me is to add an address field (that gets geocoded) and a text field field and render that with a view / code on the map myself.

    Thank you for your feedback.

  • 🇮🇹Italy itamair

    Hi @f0ns ... now probably better understand your needs here.
    Yes, at the moment the Leaflet module is using the leaflet-geoman js library to enhance its widget editing experience,
    and that doesn't yet implement a geocoding/reverse geocoding address mechanism to input and manage your points insertions on the map.
    May be we should find a way to add all that, but won't be immediate, and still haven't properly though about that ...

    Also because the most proper way for inputing JUST Geofield POINTs on the Map would be (imho) to use the additional and complementary Geofield Map module , that indeed implements a Geocoding additional Input element on the Geofield Field Map widget itself, and also the option to sync the Geofield itself with an additional Entity Field that could act as Reverse Geocode result on the map.
    As Geofield Map Widget backgrounds Tile you can still use Leaflet js library and also the Geocoder module integration, with GM module, so not forced to rely on Google Maps API Key for that ...

    Hope this helps you further ...

  • 🇧🇪Belgium f0ns

    Hello thank you for your feedback, it does indeed steer me in the right direction.

    The geocoding might overcomplicate it a bit.

    I think I didn't take enough time to try to describe what I was looking for.

    In the current module you can drop markers which is great but there is no out of the box way (as I can see) to add some context to a marker (which is shown in the tooltip).

    For example it would be great to add markers in a neighbourhood to show locations like:

    • Drop marker on the map and add a label "Post office" (that is shown in a tooltip when viewing the marker on the map)
    • Drop marker on the map and add a label "School" (that is shown in a tooltip when viewing the marker on the map)
    • Drop marker on the map and add a label "Bakery" (that is shown in a tooltip when viewing the marker on the map)
    • Drop marker on the map and add a label "Coffee shop" (that is shown in a tooltip when viewing the marker on the map)

    Thank you for the time to answer my questions and the work on this module.

    Have a great day

    Fons

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

Production build 0.71.5 2024