Starting with version 3.2.1, Gallery3x ships the [[!Gallery3xEmbeds]] snippet, which outputs embedded objects (embeds) on site pages — maps, widgets, players and any iframe content added in the resource's “Embed G3x” tab.
The “Embed G3x” tab is enabled by the
gallery3x.embed_enablesetting.
Key feature
Each embed is added in the manager in one of two modes:
Link — you paste a link (for example to Yandex Maps or Google Maps), the component recognises it and builds a safe
<iframe>itself.Embed code — you paste ready-made embed HTML (the “Share → Embed” button on the source site); it is output as is.
The snippet passes ready HTML of the embed to the chunk in the [[+embed_html]] placeholder, with a responsive wrapper (100% width, height from the “Height” field, 400px by default).
The [[!Gallery3xEmbeds]] snippet
Its main job is to get all active embeds of the given resource, sort them and pass them to chunks for rendering.
| Parameter | Default | Description |
|---|---|---|
| &resource | current resource ID | Resource to output embeds from. Used if &parents and &resources are not set. |
| &parents | null | Parent resource IDs, comma-separated. Selects embeds from them and all their children. 0 — from the whole site. |
| &resources | null | Resource IDs, comma-separated. An ID with a minus (-) excludes the resource. Takes priority over &parents. |
| &tplOuter | tpl.Gallery3x.Embed.outer | Wrapper chunk for the whole list. |
| &tplItem | tpl.Gallery3x.Embed.item | Chunk for one item (ignored in Fenom mode). |
| &fenom | 0 | If 1 and pdoTools is installed — Fenom mode. &tplItem is not used, and &tplOuter receives the {$embeds} array to process in {foreach}. |
| &group | '' | Filter by group (several, comma-separated). |
| &limit | 0 | Limit. 0 — no limit. |
| &offset | 0 | Offset (for pagination). |
| &sortby | position | Sort field. |
| &sortdir | ASC | Sort direction (ASC or DESC). |
| &showInactive | 0 | If 1 — embeds disabled in the manager are output too. |
| &where | '' | JSON string with extra selection conditions. |
| &debug | 0 | If 1 — the prepared data array is shown instead of the output. |
| &source | — | Media source for thumbnail URLs (ID or name). Empty — the record's source. |
Available placeholders
In the wrapper (&tplOuter): [[+items]] — all embeds rendered with &tplItem; [[+total]] — the count; [[+first.title]] etc. — fields of the first one. In Fenom — {$embeds}, {$total}, {$first}.
The snippet passes all fields of the embed record to the chunk. The main one is [[+embed_html]] (HTML ready for output).
[[+embed_html]]— ready HTML of the embed with a responsive wrapper (this is what you output).[[+id]]— record ID.[[+title]]— title.[[+description]]— description.[[+mode]]— mode:urlorcode.[[+url]]— source link (“Link” mode).[[+code]]— embed code (“Embed code” mode).[[+provider]]— provider (yandex_map,google_map).[[+embed_id]]— the final iframesrc(“Link” mode).[[+height]]— height in px (empty = 400).[[+thumbnail_url]]— thumbnail URL (if set).[[+group]]— groups (separated by||).[[+position]],[[+active]],[[+special]]— position, active flag, “special”.[[+extra_text]],[[+extra_text2]],[[+extra_num]],[[+extra_date]]— extra fields.
Examples
[[!Gallery3xEmbeds]]
Output all embeds of the current resource.
[[!Gallery3xEmbeds?
&group=`maps`]]
Only embeds from the maps group.
[[!Gallery3xEmbeds? &resource=`15`
&limit=`3`]]
Three embeds from resource #15.
[[!Gallery3xEmbeds? &fenom=`1` &tplOuter=`
tpl.Gallery3x.Embed.outer.fenom`]]
Fenom mode — processing the {$embeds} array in a loop inside the wrapper chunk.
[[!Gallery3xEmbeds? &debug=`1`]]
Debugging — shows all prepared data.