Unpublish all language instances of an entity

Created on 19 January 2018, over 7 years ago
Updated 18 April 2024, over 1 year ago

Our project contains 2 languages, german and english. There is a vocabulary "Channel". We now would like to have a channel term that has a translation but also both language instances should be unpublished.

When trying to unpublish the translated term the status field is disabled with a description showing: "Only this translation is published. You must publish at least one more translation to unpublish this one.".
Also in code there is a comment saying: "If there is only one published translation we cannot unpublish it, since there would be nothing left to display."

Can anyone explain the deeper reasons for this to me? I don't understand why one would not want to unpublish all language instances of a given term.

Common Use Case: An editor wants to unpublish all translations of a node so that the page is no longer visible to anonymous traffic for any language.

๐Ÿ› Bug report
Status

Needs work

Version

11.0 ๐Ÿ”ฅ

Component
Content translationย  โ†’

Last updated about 1 month ago

No maintainer
Created by

๐Ÿ‡ฉ๐Ÿ‡ชGermany lucastockmann

Live updates comments and jobs are added and updated live.
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.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States recrit

    I have ran into this multiple times as well.
    Common Use Case: An editor wants to unpublish all translations of a node so that the page is no longer visible to anonymous traffic for any language.

    Can a core maintainer weigh in on the logic behind this?
    Form description: "Only this translation is published. You must publish at least one more translation to unpublish this one."
    Code comment in "core/modules/content_translation/src/ContentTranslationHandler.php":

          // If there is only one published translation we cannot unpublish it,
          // since there would be nothing left to display.
    

    - "nothing left to display": that is the goal for the use case mentioned above. Users that can view unpublished content will still be able to view it.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States recrit
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States recrit
  • First commit to issue fork.
  • Status changed to Closed: works as designed about 1 month ago
  • ๐Ÿ‡ธ๐Ÿ‡ชSweden peter tรถrnstrand

    This has changed in core 11.x. Term entities no longer have this problem. Group and media entities still does though.

    The way to handle this is to specify a translation handler in the entity type:

    #[ContentEntityType(
      id: 'taxonomy_term',
      ...
      handlers: [
        'storage' => TermStorage::class,
        ...
        'translation' => TermTranslationHandler::class,
      ],
      ...
    )]
    

    See Drupal\node\NodeTranslationHandler and Drupal\taxonomy\TermTranslationHandler.

    I'm closing this as works as designed as there is a solution for this available for contrib and a separate issue for component "media sytem". See related issues.

Production build 0.71.5 2024