Token substitution fatal error: getEntityTypeId() on null in entity_ui_tokens()

Created on 11 November 2024, about 2 months ago

Problem/Motivation

Steps to reproduce

Install this module on a fresh Drupal 10.3.6 site, go to /admin/structure/entity_ui/entity_tab/add/node/owner_assign to create a new tab to assign nodes, try to use a token in the Page title, starting with [entity_ui_tab:target_entity: like suggested. I tried:
[entity_ui_tab:target_entity]
[entity_ui_tab:target_entity:title]
[entity_ui_tab:target_entity:label]
[entity_ui_tab:target_entity:id]
[entity_ui_tab:target_entity:nid]
[entity_ui_tab:target_entity:author]
[entity_ui_tab:target_entity:created]
but all returned this error when visiting the newly created tab on a node:

Error: Call to a member function getEntityTypeId() on null in entity_ui_tokens() (line 41 of modules/contrib/entity_ui/entity_ui.tokens.inc).

Proposed resolution

  1. Just show the token text when a substitution isn't available (instead of a fatal error).
  2. Make existing node & entity tokens work.
  3. Show the usual "Browse available tokens" link in the tab from to suggest working tokens.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.9

Component

Code

Created by

🇮🇹Italy kopeboy Milan

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

Comments & Activities

Production build 0.71.5 2024