diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index d78a0e26d5..b82af9bd31 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -263,9 +263,11 @@ public function createRevision(RevisionableInterface $entity, $default = TRUE, $ $keep_untranslatable_fields = TRUE; } - // Populate the "original" property with the current values, given that - // the new revision is not stored anywhere. This way we can detect changes - // properly. + // The "original" property is used in various places to detect changes in + // field values with respect to the stored ones. If the property is not + // defined, the stored version is loaded explicitly. Since the merged + // revision generated here is not stored anywhere, we need to populate the + // "original" property manually, so that changes can be properly detected. $new_revision->original = clone $new_revision; } diff --git a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php index 39ed9e00a4..6ac7d034b9 100644 --- a/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php +++ b/core/lib/Drupal/Core/Entity/Plugin/Validation/Constraint/EntityUntranslatableFieldsConstraintValidator.php @@ -91,11 +91,14 @@ public function validate($entity, Constraint $constraint) { protected function hasUntranslatableFieldsChanges(ContentEntityInterface $entity) { $skip_fields = $this->getFieldsToSkipFromTranslationChangesCheck($entity); /** @var \Drupal\Core\Entity\ContentEntityInterface $original */ - $original = isset($entity->original) ? - $entity->original : - $this->entityTypeManager + if (isset($entity->original)) { + $original = $entity->original; + } + else { + $original = $this->entityTypeManager ->getStorage($entity->getEntityTypeId()) ->loadRevision($entity->getLoadedRevisionId()); + } foreach ($entity->getFieldDefinitions() as $field_name => $definition) { if (in_array($field_name, $skip_fields, TRUE) || $definition->isTranslatable() || $definition->isComputed()) {