Leaflet Zoom Link
This module adds a field formatter to Geofields that displays a "View on Map" link. Clicking this link will either scroll to a target Leaflet map on the current page, zoom to the field's coordinates, and open the popup, or navigate to a different page with the map and zoom to the specified coordinates.
Leaflet Zoom Link provides a Geofield field formatter that renders a "View on Map" link targeting a Leaflet map elsewhere on your site.
When the target map is already on the same page, clicking the link scrolls to the map container, zooms to the field's coordinates, and opens any matching marker popup — without a full page reload. The browser history is updated so the zoomed state is bookmarkable and the back button works correctly.
When the map lives on a different page, the link navigates naturally. The module appends lat and lon query parameters to the URL and sets the map element ID as the URL fragment. On arrival, JavaScript auto-zooms the map once the Leaflet instance is ready.
Features
- Works across pages or in-place on the same page
- Auto-opens marker popups at the target coordinates
- Bookmarkable URLs with
lat/lonquery parameters - Configurable map page URL (route name or internal path), map element ID, and link text
- Themeable via
leaflet-zoom-link.html.twig