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, whichEntityChangedConstraintValidator
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
- Write tests for the revision translation affected problem
- Review patch
- 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.