getParentEntity() does not respect translation fallbacks

Created on 22 February 2017, almost 8 years ago
Updated 6 September 2024, 4 months ago

This is a follow-up to #2790613: getParentEntity() does not return translated parent entity β†’ . Now that the getParentEntity() method intends to return the translation of the parent entity that matches the translation of the paragraph, it could also respect language fallbacks. (Projects like language hierarchy β†’ allow fallbacks to be specified, so a direct translation does not necessarily have to exist, but another translation gets used instead.)

Basically, rather than just using the hasTranslation() method, the fallback candidates should be obtained and looped through to get the 'most appropriate' translation. This is what core's EntityRepository class does, so the forthcoming patch will be based on its getTranslationFromContext method.

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom james.williams

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024