diff --git a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php index 285df5a..5a45f88 100644 --- a/core/lib/Drupal/Core/Entity/EntityDisplayBase.php +++ b/core/lib/Drupal/Core/Entity/EntityDisplayBase.php @@ -399,6 +399,7 @@ public function __sleep() { // Only store the definition, not external objects or derived data. $keys = array_keys($this->toArray()); $keys[] = 'entityTypeId'; + $keys[] = 'enforceIsNew'; return $keys; } @@ -408,7 +409,9 @@ public function __sleep() { public function __wakeup() { // Run the values from self::toArray() through __construct(). $values = array_intersect_key($this->toArray(), get_object_vars($this)); + $is_new = $this->isNew(); $this->__construct($values, $this->entityTypeId); + $this->enforceIsNew($is_new); } }