The Leaftlet module 10.0.x released on 23 November 2022 with full support for Drupal 10 (and Drupal 9). This version is also backward compatible with 2..2.x. You can seamlessly upgrade to 10.0.0 with out worrying about losing any configurations. This module integrates Drupal with the popular LeafletJS. The 10.0.0 is considered a much more stable and documented release than its predecessor 2.2.12.
The module provides Leaflet Map Geofield Widget and Leaflet Map Geofield Formatter to render your geocoded data. It also supports Views integration with Leaflet Views submodule and Leaflet Markercluster Js plugin functionalities with Leaflet Markercluster submodule. The leaflet module is an integral component of the Drupal Geofield Mapping stack, which includes other main modules such as Geofield, and Geocoder.
As per the release notes Leaflet 10.0.0 comes with
- Full support for Drupal 10;
- Backward compatibility for Leaflet module 2.2.x
- Implementation of Leaflet Views Grouping, reflecting into Leaflet Control Overlays, with:
- Options to initially disable specific Groups and/or not include them in the Leaflet Overlays Control;
- Markerclustering support;
- Specific/additional hook_leaflet_views_features_group_alter to alter Leaflet View Group definitions;
- Featured implementation to dynamically exclude specific Leaflet Features from being Markercluster-ed (“Markercluster excluded” element/flag);
- Full Implementation / support of Leaflet Tooltips (https://leafletjs.com/reference.html#tooltip), with custom Json options, tokens & replacements patterns;
- Extended support for Leaflet Popups (https://leafletjs.com/reference.html#popup), with custom Json options, tokens & replacements patterns;
- Full Implementation / support of User Location Control via Leaflet.Locate plugin (https://github.com/domoritz/leaflet-locatecontrol), with custom Json options, tokens & replacements patterns;
- Full implementation / support for Reset Map View Control via Leaflet.ResetView plugin (https://github.com/drustack/Leaflet.ResetView), with custom Json options, tokens & replacements patterns;
- Implementation of Leaflet Feature Additional Properties (with custom Json options, tokens & replacements patterns) for advanced and dynamic customisation of Leaflet Map and Features rendering logics;
Code Refactoring & clean up:
- Cleanup / removal of deprecated and un-usable Leaflet Views plugins.
- Extended refactoring of Leaflet module js code, to allow easier extension/customisation of Drupal.leaflet.prototype and Drupal.leaflet_widget.prototype methods, with extended objects, functions and methods documentation;
- Embedding all Leaflet Js libraries dependencies into the the module, for better Ajax and advanced Fields Widgets compatibilities (Inline Entity Form, Paragraphs Widgets supports, etc.)
- General Drupal/PHP & JS better refactoring, complying with correct Coding Standards;
A full demo of the Leaflet Drupal module is available here.
Installing Leaflet on Drupal 9 or Drupal 10
composer require drupal/leaflet
This will also download the required Geofield Module dependency and GeoPHP library. You can now enable Leaflet, Leaflet Views and Leaflet Markercluster as required.