The Field Tokens module adds two additional types of field tokens: Formatted fields and field properties.

Formatted field tokens

Formatted Field tokens are tokens allowing one or many field values to be rendered via the default or specified field formatter.

The format is:

[PREFIX:DELTA(S):FORMATTER:FORMATTER_SETTING_KEY-FORMATTER_SETTING_VALUE:...]

(e.g. [node:field_image-formatted:0,1:image:image_style-thumbnail]).

Formatter settings that are themselves arrays (e.g. the image formatter's image_loading) can be set using dot notation in the setting key:

[PREFIX:DELTA(S):FORMATTER:PARENT.CHILD-VALUE:...]

Field property tokens

Field property tokens are tokens allowing access to field properties on one or many fields.

Properties are dependent on the field type.

The format is:

[PREFIX:DELTA(S):PROPERTY]

(e.g. [node:field_image-property:0:entity:url]).

When a field property stores an array, additional colon-separated segments traverse into the value using each segment as a key:

[PREFIX:DELTA(S):PROPERTY:KEY:KEY:...]

Entity delta token

A delta token is available on every entity token type (e.g. [file:delta], [node:delta]). It returns the zero-based position of the entity within its parent multi-value field. The delta is provided at runtime by the calling code.

Delta specification

The DELTA(S) position supports multiple formats for selecting which field item values to render:

  • Single: 0
  • Comma-separated: 0,2,4
  • Range: 0-2
  • Mixed: 0-2,4,6-8
  • Wildcard: *
  • Omitted: all field items

Custom Formatters integration

When used with the Custom Formatters module, tokens like [formatted_field-image:image:...] and [field_property:alt] can be used directly in HTML + Token formatters without entity-level chaining.

Required modules

Recommended modules

Supporting organizations: 
Development
Drupal 9 development
Drupal 9 development

Project information

Releases