Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Entity Deep Token

Security covered Under active development 18 sites

Part of the Entity ecosystem · 308 projects

This module allows you to create custom tokens that can access data from related entities, even across multiple levels of connections. It's useful for building dynamic content, breadcrumbs, or URLs based on deeply nested entity information.

Entity Deep Token

Provides customizable tokens to recursively access fields of related entities.

This module defines a new token type called `entity_deep_token`, which allows you to traverse relationships between entities (such as nodes) and access properties like ID, label, bundle, or raw field values, even across multiple levels of depth.

Purpose

By default, Drupal’s token system only supports direct (one-level) relationships. This module enables token-based access to deeply nested related entities, which is particularly useful for:

  • Hierarchical breadcrumbs generation.
  • Metadata generation based on related entity values.
  • Custom URL building and conditional logic.

Installation

Install the module via Composer:

composer require drupal/entity_deep_token

Enable it via the admin interface or Drush:

drush en entity_deep_token

How to Use

The module adds a new token type: entity_deep_token. It works in any entity context (e.g., node) and allows you to traverse entity reference chains using a structured syntax.

General Syntax

[entity-deep-token:<field>:entity:<field>:entity:<property>]

  • <field>: Name of the entity reference or other field.
  • entity: Indicates traversal to the referenced entity.
  • <property>: Values like id, label, bundle, value, target_id, etc.

Example 1:

degree node → department → school

Entity relationship:

degree → field_department → department → field_school → school

Get the school node ID:

[entity-deep-token:field_department:entity:field_school:entity:id]

Get the school node title:

[entity-deep-token:field_department:entity:field_school:entity:label]

Get the school node bundle:

[entity-deep-token:field_department:entity:field_school:entity:bundle]

Example 2: Get raw creation date from a related entity

Suppose you have an entity reference field field_related_node and you want the creation timestamp:

[entity-deep-token:field_related_node:entity:created:value]

Limitations

Only works when in an entity context (node, user, taxonomy_term, etc.).

Does not yet support multiple values in reference fields (only the first item is accessed).

Does not format raw values (e.g., timestamps are not human-readable).

Future Ideas

  • Support multiple field values (e.g., 0, 1, etc.)
  • Support date formatting via date:format
  • Better integration with the Token UI (autocomplete suggestions)

Maintenance

This module is experimental but stable. Contributions, bug reports, and feature requests are welcome.

Drupal 10–11

Ask your assistant about Entity Deep Token

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
5
Tracked since
Jun 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 5
Maintenance
Dormant

Release Timeline

Releases

Version Type Core PHP Release date
1.0.3 Stable 10–11 Jul 25, 2025
1.0.2 Stable 10–11 Jul 24, 2025
1.0.1 Stable 10–11 Jun 26, 2025
1.0.0 Stable Jun 25, 2025
1.0.x-dev Dev 10–11 Jun 25, 2025