Fatal error in deep token usage in advanced display

Created on 19 January 2025, 3 months ago

Problem/Motivation

Using custom field with a deep (6th level) token in advanced template display causes a fatal error.

Steps to reproduce

Define a Paragraph with a custom_field where a subfield is an entity reference to taxonomy terms.
The taxonomy term include a field that is another custom_field where a subfield X is simply a text field with a select list as widget.
The display of paragraph is using advanced template to show the value of X.
Currently, trying to display the article that includes the paragraph results in a
Uncaught PHP Exception TypeError: "Cannot access offset of type array on array" at web/modules/contrib/custom_field/custom_field.tokens.inc line 302

In my specific case, the template is the following
[paragraph:field_brand_pr_info_base:type:entity:field_tags_info:plural:value]

Proposed resolution

I don't know if it is a problem of a too long token reference, since
[paragraph:field_brand_pr_info_base:type:entity:field_tags_info]
works fine.

Remaining tasks

test

User interface changes

none

API changes

none

Data model changes

?

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

🇮🇹Italy giuse69

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024