Fails if no translation to current language

Created on 24 March 2025, 13 days ago

Problem/Motivation

If field_target_entity is applied to a field referring to a translatable entity and the value refers to an entity that is not translated to the current language alert 'The field_target_entity twig filter does not support access control at field item level' is triggered and nothing is returned.

Steps to reproduce

Create an entity bundle with an entity reference field referring to a translatable entity.
Create the referred entity that is not translated to all languages.
Create the referring entity with a translation to a language to which the referred entity is not translated but still refer to that entity.
Create a template using the field_target_entity filter on the reference field.
Display that entity
Notice that no content will be displayed where expected
Check the log for the alert.

Proposed resolution

A patch to FieldValueExtension::getTargetEntity, probably around line 215. It should presumably return the default language translation.

Remaining tasks

Write patch

User interface changes

Default language content returned

API changes

None

Data model changes

None

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇬🇧United Kingdom Rory Downes

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

Comments & Activities

Production build 0.71.5 2024