Skip to content

Map Field (PRO)

A map with markers. Each marker carries a title, an alias, a phone, an email, an address and a description, so one field describes a whole set of points.

Which map is drawn

The provider is chosen once for the site, by the pageblocks_map_type system setting:

ValueProviderKey needed
leafletLeaflet over OpenStreetMapNo
ymapsYandex MapsYes — pageblocks_yandex_apikey
googlemapsGoogle MapsNot handled in the component

Settings common to all: map centre (48.737, 18.893) and zoom. Leaflet adds a marker icon, its size, the tile style (light, dark, voyager or your own) and the interaction switches — dragging, scroll zoom, double-click zoom, keyboard, touch zoom. Google exposes its own set of controls instead. Yandex takes only centre and zoom.

Leaflet is the default, and it needs nothing

After installing, pageblocks_map_type is set to leaflet: it works with no key and no registration anywhere. For most sites that is the whole of map configuration.

Switch to ymaps and you must fill in pageblocks_yandex_apikey, or the map stays blank.

Output is yours to write

The value is a JSON array of markers:

json
[{"lat": 55.755826, "lng": 37.617299, "title": "Office", "address": "…"}]

No ready-made snippet renders it. Decode the value and feed the coordinates to whichever map library the theme already loads:

html
<div id="map" data-markers='{$points}'></div>

That is deliberate on the front end: the manager needs one provider, a page may need another, and the markers are plain data either way.

© PageBlocks 2019-present