Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 299620

Changed time not updated when only non-translatable fields are changed on a translated entity

$
0
0

Problem/Motivation

Given an entity that has been translated (=== has more than 1 translation) that has an untranslatable field. When you change only that untranslatable field, ContentEntityBase::hasTranslationChanges() will return FALSE for all translations of that entity, even though in effect all translations have changed because untranslatable fields affect every language.

As ContentEntityBase::hasTranslationChanges() is used in two places in core, this has two different consequences:

Changed time tracking
Because forms explicitly update the changed timestamp whenever they are saved, this is only a problem when calling $entity->save() explicitly. In that case, though, because the changed timestamp is not updated, you can have sequential $entity->save() calls overwriting the other's data, which EntityChangedConstraintValidator would otherwise prevent
Tracking affected translations of a revision
This would lead to a new revision being marked as affecting no languages, so that it would not be visible at all in the user interface and, thus, not revertable. Because (as stated above), the changed time of the translation that is being edited is being explicitly changed (and because the changed field is translatable) this problem is somewhat masked, because this means that the translation that is being edited is always being marked as affected. Arguably, however, all translations should be marked as affected.

Proposed resolution

Remove the FieldDefinitionInterface::isTranslatable() check from ContentEntityBase::hasTranslationChanges().

Remaining tasks

  1. Write tests for the revision translation affected problem
  2. Review patch
  3. Write change notice

User interface changes

None.

API changes

This is a change in behavior, but as argued above the current behavior is a bug. The implications of this will have to be discussed in more detail.

Data model changes

None.


Viewing all articles
Browse latest Browse all 299620

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>