"Entity untranslatable fields" constraint prevents flagging translations as outdated

Created on 31 January 2023, over 1 year ago
Updated 16 October 2023, 9 months ago

Problem/Motivation

The "Entity untranslatable fields" constraint validator fails in the setting where "Hide non translatable fields on translation forms" is enabled and an entity form is submitted with a change in a non-translatable field and the checkbox "Flag other translations as outdated" is checked.

Steps to reproduce

  1. Configure a content type with a non-translatable field.
  2. Enable content translation for this content type and enable the setting "Hide non translatable fields on translation forms".
  3. Create content for this content type and translate it.
  4. Ensure that under the translation overview, all translations appear as published and none of them is outdated.
  5. Edit the source translation, change the non-translatable field and check the checkbox "Flag other translations as outdated".
  6. Observe how the "Entity untranslatable fields" constraint fails since the setting "Hide non translatable fields on translation forms" is enabled, a non-translatable field has been changed and a field (content_translation_outdated) of other translations have been updated.

Proposed resolution

Consider excluding the content_translation_outdated field from being checked by ContentEntityBase::hasTranslationChanges(). Maybe we should define all content translation fields as revision metadata fields and register them on the entity type in which case EntityChangesDetectionTrait::getFieldsToSkipFromTranslationChangesCheck() will be always excluding them from the ContentEntityBase::hasTranslationChanges() check?

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
Content translationΒ  β†’

Last updated 2 days ago

No maintainer
Created by

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

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.

  • Issue created by @hchonov
  • πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬
  • πŸ‡ΊπŸ‡ΈUnited States merauluka

    I have been able to trigger this same error by:
    * Enabling translation on content
    * Creating a node and a translation of that node.
    * Editing the original node and resaving with "Flag other translations as outdated" checked by default.

    So, basically, we are unable to resave the default translation once a translation exists.

    I am seeing this on Drupal 9.5.11.

  • last update 9 months ago
    30,412 pass
  • @merauluka opened merge request.
  • πŸ‡ΊπŸ‡ΈUnited States merauluka

    I have created an MR using the recommendation from the original post. The MR updates the getFieldsToSkipFromTranslationChangesCheck method to skip fields from the content_moderation module.

    A more flexible approach would be to make this feature configurable so other can define fields that they would like to ensure are skipped when performing a diff of untranslated fields on save.

Production build 0.69.0 2024