Collision between entities tokens and fields machine names

Created on 30 March 2025, 7 days ago

Problem/Motivation

If we remove the "body" field from a node content type and add another text field called "summary" to that content type, the token [node:summary] is not working anymore when field prefix has been removed (or if the field's name is "mary" when field_prefix is "sum").
This is not node specific and can happen with any other entity.

Steps to reproduce

  • Install and activate Token module
  • Alter field_ui.settings.yml, set field_prefix: '' and import the config
  • Manage the Page content type fields, remove the "body" field
  • Add a text field called "Summary" (with "summary" as machine name) to the Page content type fields
  • Create a page node and fill in your summary field
  • Use the token (ex: in a metatag content type description add [node:summary])
  • Check the use of your token, no data comes up (with the previous example: View your node and access the source code ; there is no meta description)

Proposed resolution

Forbid to give a machine name equal to an entity token key when we create fields on that entity.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇷France MacSim

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024