Prevent language fallback to happen when a translation is unpublished

Created on 2 December 2020, about 4 years ago
Updated 18 September 2023, over 1 year ago

Problem/Motivation

In this particular example, I'm having translatable nodes with a paragraph field on them. Each paragraph has a "published" flag which itself is translatable. The goal was if I have a translation of the node but don't want to show one of the paragraphs there, I could simply unpublish it and it won't get shown on the translation.

What actually happens is that another language of the same paragraph which itself is published (coming from another translation of the same node) is being shown.

Using the hook_language_fallback_candidates_OPERATION_alter hook I could empty the $candidates, but the default language of the site would still get added in the candidates list and therefore the paragraph would be shown in the site's default language.

Proposed resolution

When I supposedly clear the $candidates array in hook_language_fallback_candidates_OPERATION_alter, the core should check for this case and not add the default language, so we still display this exact entity translation, which in the end won't get displayed because of status = 0.

✨ Feature request
Status

Needs work

Version

9.5

Component
EntityΒ  β†’

Last updated about 1 hour ago

Created by

πŸ‡¨πŸ‡­Switzerland florianmuellerch Aarau, Switzerland

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

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