Get current translation of entity if exists

Created on 24 February 2023, over 1 year ago

Problem/Motivation

When using the pattern formatters on entity reference fields which are not translatable but the target entities are, the source translation is always used in tokens referencing the target entity in the pattern settings.

Steps to reproduce

1. Set up drupal site with multple languages
2. Create a node type (node_type_a) that is trandlatable
3. Create a node (page_a) of type node_type_a and translate it to at least one more language
4. Create a field (field_untranslatable_ref) that is not translatable on a node type
5. Reference page_a from the field_untranslatable_ref
6. Create a pattern (pattern_a) that has settings
7. Output the field_untranslatable_ref as a pattern_a and set `[node:url]` as the setting
8. See that the setting is the source tranlation of page_a no matter what language is rendreed
Create a entity reference field on a node type

Proposed resolution

Use the current rendered translation of page_a above if it exists.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΈπŸ‡ͺSweden auth

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

Comments & Activities

Production build 0.71.5 2024