Search by

lapis / map

toros.egon

Maps for Lapis CMS: a map block for OpenStreetMap, Google Maps and Mapbox, with links to Apple and Google Maps

v1.0.0 2026-12-01 21:55 UTC

This package is auto-updated.

Last update: 2026-12-01 22:10:20 UTC


README

Maps for Lapis CMS: a map block that editors fill in on the page, with OpenStreetMap, Google Maps or Mapbox, and links to open the place in Google Maps, Apple Maps and OpenStreetMap.

composer require lapis/map
<x-block type="map" name="map" global>Map coming soon.</x-block>

Clicking the block opens its fields: the address, the coordinates, the zoom and the map. No JavaScript, and nothing to set up for OpenStreetMap.

The maps

Map Needs Embedded as
OpenStreetMap (default) the coordinates an iframe with a marker; no key, no cookies
Google Maps the address or the coordinates an iframe; with map_google_key set (Settings → Map) through Google's Maps Embed API, without it the classic embed
Mapbox the coordinates and map_mapbox_token a picture (Static Images API) with a pin; no script

When a map cannot be drawn (OpenStreetMap without coordinates, Mapbox without a token), the block shows OpenStreetMap if it has the coordinates, else only the address and the links. The links are always there, for directions on a phone.

The coordinates are latitude and longitude, 47.4979, 19.0402: right-click the place in Google Maps or OpenStreetMap to copy them. The plugin does not look addresses up itself.

Cookies

Google Maps sets cookies. With lapis/cookie-consent installed, a Google map waits for consent: a short text and an Accept button show in its place. List Google Maps among the site's services there, so the cookie list tells visitors about it. OpenStreetMap and Mapbox load without waiting.

Its look

A page with a map gets the plugin's styles in its <head>. Three ways to change them:

  1. Variables, anywhere in the site's CSS: --lapis-map-aspect-ratio (16 / 9), --lapis-map-radius (.5rem), --lapis-map-border (0), --lapis-map-background (shown while it loads), --lapis-map-gap.
  2. Plain rules. The styles sit in @layer lapis-map behind :where(), so any rule of the site wins: .lapis-map-links { display: none; }. The classes: .lapis-map, .lapis-map-frame, .lapis-map-address, .lapis-map-links.
  3. Replace them. The styles are the component x-map-style; a site's own components/x-map-style.view.php takes its place (an empty file: no styles from the plugin).

While an editor edits the page, a click on the map opens its fields instead of moving the map.

The texts are under map.* (English and Hungarian included); a site changes them in its own app/localization.<locale>.yml.