Automatically expose typed data to token API

Created on 30 December 2013, over 11 years ago
Updated 10 April 2025, 8 days ago

Updated: Comment #N

Problem/Motivation

In Drupal 7 entities and their properties could be exposed to the token API automatically through entity_token, a sub module of the contributed Entity module. Most of the module has been merged with Drupal core, but there is no automatic exposure to token API yet.

Proposed resolution

Make the System module expose typed data in hook_token_info(), and perform replacements in system_tokens().

Remaining tasks

  1. #2002134: Move TypedData metadata introspection from data objects to definition objects will allow us to retrieve typed data property definitions without needing data instances.
  2. Add support for typed data selection Needs work will help us get the typed data values using token selectors.
  3. 📌 Type token returns in a typed data recognizable format Needs work is a preparatory issue that makes sure existing token definitions are compatible with typed data IDs.
  4. Introduce a new “typed_data” (bool) property to token definitions.
  5. Update System module's token hook implementations. It will perform access control and return the replacement value (which implements TypedDataInterface) its getValue() return value. Token::replace() must accept an AccountInterface object for runtime access control.

User interface changes

None.

API changes

None.

Feature request
Status

Postponed: needs info

Version

11.0 🔥

Component

token system

Created by

🇬🇧United Kingdom Xano Southampton

Live updates comments and jobs are added and updated live.
  • stale-issue-cleanup

    To track issues in the developing policy for closing stale issues, [Policy, no patch] closing older issues

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇺🇸United States smustgrave

    Thank you for sharing your idea for improving Drupal.

    We are working to decide if this proposal meets the Criteria for evaluating proposed changes. There hasn't been any discussion here for over 8 years which suggests that this has either been implemented or there is no community support. Your thoughts on this will allow a decision to be made.

    Since we need more information to move forward with this issue, the status is now Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

Production build 0.71.5 2024