Skip to content

Render: Twig

Plugin ID: eca_render_twig

Available since: 1.1.0

Render an inline template using the Twig engine.

Fields

Template — config key: template

Must be valid Twig syntax. Token data is available as Twig variables (for example {{ node.title.value }}); raw [token] replacement of the template source is no longer performed.

Type: textarea · Required: yes · Default: empty string

Context values — config key: value

Optionally specify context values to pass to the template. Can be an array using YAML syntax (needs to be enabled below) or a token holding the context data. Available token data will be automatically forwarded.
This field supports tokens.

Type: textarea · Required: no · Default: empty string

Interpret above value as YAML format — config key: use_yaml

Nested data can be set using YAML format, for example mykey: "My value". When using this format, this option needs to be enabled. When using tokens and YAML altogether, make sure that tokens are wrapped as a string. Example: title: "[node:title]"

Type: checkbox · Required: no · Default: false

Validate YAML to prevent this from being executed when invalid — config key: validate_yaml

Type: checkbox · Required: no · Default: false

Machine name — config key: name

Optionally define a machine name of this render element. It will be made available under that name in the render array of the current event in scope. Nested elements can be set with using "][" brackets, for example details][title.
This field supports tokens.

Type: textfield · Required: no · Default: empty string

Token name — config key: token_name

Optionally define a token name of this render element. It will be made available under that token name for later usage. Please provide the token name only, without brackets.

Type: textfield · Required: no · Default: empty string

Element weight — config key: weight

Optionally specify an element weight. The lower the weight, the element appears before other elements having a higher weight.
This field supports tokens.

Type: textfield · Required: no · Default: empty string

Build mode — config key: mode


When using the "Defined by token" option, make sure there is a token with this name: eca_render_twig_mode

Type: select · Required: yes · Default: append

Allowed values: set:clear, set:clear:defined, merge, prepend, append, nothing, _eca_token