diff --git a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php index a3bb20508f..55c218048d 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php @@ -369,6 +369,15 @@ protected function doPreSave(EntityInterface $entity) { $entity->updateLoadedRevisionId(); } + // Make sure that the original entity is the revision the current entity was + // originated from, otherwise we would always compare the current values + // with the default values, which is not correct for pending revisions. If + // we have the default revision we let the parent populate the "original" + // property via a more performant entity load. + if (!isset($entity->original) && $this->entityType->isRevisionable() && !$entity->isDefaultRevision()) { + $entity->original = $this->loadRevision($entity->getLoadedRevisionId()); + } + $id = parent::doPreSave($entity); if (!$entity->isNew()) {