Unpublished entity reference translations use a fallback while unpublished translations of the main entity do not

Created on 10 April 2023, over 1 year ago
Updated 25 April 2023, over 1 year ago

Problem/Motivation

If we consider a node having English as its source translation and a German translation that is unpublished then when viewing the node in German will result in access being denied. If we would visit the node on the path of the French site though the English translation will be loaded. This is a known discrepancy and a consensus has to be made in πŸ“Œ Unpublished translations should fallback to the original language Needs work .

The issue here deals with the case of an entity reference that has an unpublished translation. Up until #2543258: Entity references of untranslatable fields are not displayed in the correct translation β†’ Drupal core used to perform the access check on entity translation and thus filter out unpublished entity translations, but with that issue it was changed to go for a fallback translation. I think that back then we did not realize that the reported issue could be solved without adding a translation fallback for referenced entities and we simply wanted to go for the official API for retrieving entity translation from the entity repository, but did not really fully consider the implications of that API.

Depending on the POV it might be right or wrong to fall back to a translation of an entity reference different than the requested one. There are two main branches that we have to differentiate:

  • The referenced entity does not have a translation for the requested language.
  • The referenced entity has a translation for the requested language, but the current user does not have access to it - e.g. the translation is unpublished.

Steps to reproduce

Proposed resolution

If an entity reference does not have a translation for the requested language then use a fallback. This solves the case when the entity is a carrier for further nested content that is actually translated.

If an entity reference has a translation for the requested language, but the current user does not have an access to it then filter it out - meaning respect the active unpublishing of an entity translation.
Since different sites / editors might have different needs here this probably has to be configurable and there should be ways for a global site configuration and for per-case configuration controllable by the editors:

  1. Add a global site setting controlling whether a translation fallback is allowed in case a missing access for a translation e.g. "Show mixed translation content".
  2. Add another property on entity reference fields allowing the editors to further specify whether the target entity can be rendered using fallback translations.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Needs work

Version

10.1 ✨

Component
EntityΒ  β†’

Last updated about 10 hours ago

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

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

Comments & Activities

Production build 0.71.5 2024