Skip to content
  1. Extras
  2. PageBuilder
  3. Field types
  4. Pro
  5. map

Field map

Version: Pro.

Why this type

An address and coordinates for a map section. After save, the field stores an embed URL and a link that opens the map. If the field type is map, or the name contains "map", the same values are also stored as map_* keys.

When to use

  • An office on a contact page
  • One delivery or pickup point
  • A map next to a form

Tips

Several points use a repeater: latitude and longitude as text fields, or your own row schema. Use the saved embed URL. Do not build the link by hand.

Similar types

  • text for address without coordinates
  • url when you already have a maps link and nobody picks a point

Schema

json
{
  "name": "location",
  "type": "map",
  "label": "Map",
  "tab": "Content",
  "width": 100,
  "active": true
}

Value

Object { lat, lng, zoom, provider }; enrich adds embed_url on the object and flat map_embed_url.

Section data

Key location in the section data after save enrich (MapEmbedResolver):

json
{
  "location": {
    "lat": 55.751244,
    "lng": 37.618423,
    "zoom": 14,
    "provider": "yandex",
    "embed_url": "https://yandex.ru/map-widget/v1/?ll=37.618423%2C55.751244&z=14&pt=37.618423%2C55.751244%2Cpm2rdm&l=map",
    "watch_url": "https://yandex.ru/maps/?ll=37.618423%2C55.751244&z=14&pt=37.618423%2C55.751244%2Cpm2rdm&l=map"
  },
  "map_embed_url": "https://yandex.ru/map-widget/v1/?ll=37.618423%2C55.751244&z=14&pt=37.618423%2C55.751244%2Cpm2rdm&l=map",
  "map_provider": "yandex",
  "map_watch_url": "https://yandex.ru/maps/?ll=37.618423%2C55.751244&z=14&pt=37.618423%2C55.751244%2Cpm2rdm&l=map"
}
  • Flat map_embed_url, map_provider, and map_watch_url duplicate the embed of the first map field (priority for key location).
  • Default provider yandex; osm is OpenStreetMap.

Chunk example

modx
<iframe src="[[+location.embed_url]]" title="Map"></iframe>
fenom
<iframe src="{$location.embed_url|default($map_embed_url)|escape}" title="Map"></iframe>

Common properties

For fields with name that are stored in the section data:

KeyTypeRoleCMP
tabstringGroup subtitle in the inspectoryes
width25–100Field width as % of the row (flex)yes
descriptionstringHint under the labelyes
defaultanyInitial value for a new sectionyes
activeboolfalse hides the field in the inspectoryes
requiredboolRequired on publish (draft still saves)yes
  • Also: enrich adds embed_url, watch_url, and flat map_* to section.data.

See fields overview.

See also