Rethinking Leaflet plugins


I recently had the need to geolocate some contents and developed a custom form field inside my theme, loading the Leaflet javascript library…

I was wondering : what if you enable multiple leaflet Grav plugins ? Each one of them will load the script and stylesheet ?
There are three Leaflet plugins referenced on Plugins | Grav CMS but they seem to be inactive for a long time and they are using very old versions of the library…

I was wondering : what if we could rethink how Leaflet plugins work ?

I’m thinking (maybe badly):

What do you think ?

I think that would be wonderful, especially a form field (just please don’t call it a “Leaflet field” :slight_smile: ).

But with three already available in the repo, it will probably be a better result if you try to add these features to one of them. That is, unless you want to do something completely differently for a good reason.

I recommend that you see if the author of the latest of these plugins will accept your feature suggestions first. If they are no longer maintaining their plugin (see Abandoned Resource Protocol), you may be able to simply fork it and take it over.

I have made a map input using Leaflet in one of my private projects. It populates a lat/lon in a form and I think ends up being inserted into a database, rather than frontmatter as you did. I had to verify and correct a whole lot of coordinates for a client’s field work. I can look this up and see if there’s anything worth sharing if you like.

There’s absolutely no point having multiple plugins to make one feature work. It’s up to user to choose which plugin to use and if someone installs several plugins to do the same thing, well… it’s up to them. Core, form field and all the output logic should be done in a single plugin