Make Leaflet Map the default display widget, when creating a new Geofield field?

Created on 13 January 2024, 10 months ago

Problem/Motivation

This may not be possible, but wouldn't it be great if "Leaflet Map" was automatically set to be the default display widget, when creating a new Geofield field, if Leaflet was already installed?

I find myself always having to change "Latitude/Longitude" to "Leaflet Map (Default)" on form and node display pages:

  • /admin/structure/types/manage/article/form-display
  • /admin/structure/types/manage/article/display

This will also make Geofield and Leaflet more welcoming for new users, since they can now simply add a Geofield, go to Add content > Map, and right away see a nice map on the form, as well as the new node, instead of a not so exciting text-field.

Steps to reproduce

  1. Create a new Geofield field
  2. Almost always have to change "Latitude/Longitude" to "Leaflet Map (Default)" on form and node display

Proposed resolution

  1. When a new Geofield field is created, check if Leaflet module is installed
  2. If yes, set "Leaflet Map (Default)" as display widget on both form and node display, not "Latitude/Longitude"

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

🇩🇰Denmark ressa Copenhagen

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

Comments & Activities

  • Issue created by @ressa
  • Status changed to Closed: won't fix 10 months ago
  • 🇮🇹Italy itamair

    thanks @ressa ...
    Personally I don't think this is a reasonable feature for the Geofield field widget ... because the Leaflet widget is not the only additional one for it (look for instance the Geofield Map module also).

    May be this could have more sense in the Leaflet module itself, and also doesn't look appropriate to me forcing the Leaflet module having this privileged role.

    I think the best way could be implement your custom hook to default set what you prefer ...

  • 🇩🇰Denmark ressa Copenhagen

    Thanks for a fast feedback @itamair, and I understand. Though, we could also just check for the two most popular options, such as Geofield Map and Leaflet, and set one of them as default widget, if they are present?

    But as I stated in the Issue Summary, I am open to this not being possible. So let's just leave it as an idea, which wasn't realistic to do.

  • 🇮🇹Italy itamair

    Feel free to inspect a solution that forces a default specific widget (i.e.: Leaflet Widget?) BUT in the dependent module (not in Geofield) such as Leaflet ...

Production build 0.71.5 2024