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
- Create a new Geofield field
- Almost always have to change "Latitude/Longitude" to "Leaflet Map (Default)" on form and node display
Proposed resolution
- When a new Geofield field is created, check if Leaflet module is installed
- 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
Comments
Comment #2
itamair commentedthanks @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 ...
Comment #3
ressaThanks 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.
Comment #4
itamair commentedFeel free to inspect a solution that forces a default specific widget (i.e.: Leaflet Widget?) BUT in the dependent module (such as Leaflet ...), and not in Geofield.