Skip to content
  1. Extras
  2. YandexMaps2
  3. Snippets
  4. YandexMaps2

YandexMaps2

Main snippet of the component that outputs the map on the frontend.

Parameters

NameDefaultDescription
parentsID of parent with nested resources that have objects on the map.
parent0ID of resource with objects on the map.
classObject class.
listdefaultList name. The map will be bound to it.
mapym2mapID of map block.
center[55.72, 37.64]Map center coordinates.
zoom10Map zoom level.
scrollZoom1Zoom on mouse scroll.
objectsInScope0Set center and zoom based on objects on the map. In other words, if true or 1, all map objects will fit in the viewport, and center and zoom properties will be ignored.
objectsArray of map objects. If specified, objects will not be fetched from the database.
defaultIconContentIcon label. Used when the map icon has no content.
defaultIconCaptionIcon title. Used when the map icon has no content.
defaultBalloonContentBalloon text. Used when the map object has no content.
modedefaultSnippet mode. Options: default, mfilter2
apiUrlLink to Yandex Maps API. If specified, overrides system setting ym2_api_url.
apiKeyYandex Maps API key. If specified, overrides system setting ym2_api_key.
scripts1Whether to load map scripts.
jquery1Whether to load jQuery.
tpltpl.YandexMaps2Map output chunk.

Important!

Specify either parents or parent parameter. They are interchangeable. Examples below show usage for better understanding.

Examples

All objects of resource 15 with class modDocument

fenom
{'!YandexMaps2' | snippet: [
  'parent' => 15,
  'class' => 'modDocument',
]}

All objects of class modDocument

fenom
{'!YandexMaps2' | snippet: [
  'class' => 'modDocument',
]}

All objects of nested resources of parent 15 with class modDocument

fenom
{'!YandexMaps2' | snippet: [
  'parents' => 15,
  'class' => 'modDocument',
]}

All objects of class msProduct with scroll zoom disabled

fenom
{'!YandexMaps2' | snippet: [
  'class' => 'msProduct',
  'scrollZoom' => false,
]}

All user objects

fenom
{'!YandexMaps2' | snippet: [
  'class' => 'modUser',
  'map' => 'ym2map-users',
]}