diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php index 8332745c740..611e28fd230 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php @@ -25,7 +25,7 @@ use Drupal\entity\EntityDisplayBase; * } * ) */ -class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayInterface, \Serializable { +class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayInterface { /** * {@inheritdoc} @@ -148,20 +148,20 @@ class EntityFormDisplay extends EntityDisplayBase implements EntityFormDisplayIn /** * {@inheritdoc} */ - public function serialize() { + public function __sleep() { // Only store the definition, not external objects or derived data. - $data = $this->getExportProperties() + array('entityType' => $this->getEntityTypeId()); - return serialize($data); + $keys = array_keys($this->getExportProperties()); + $keys[] = 'entityTypeId'; + return $keys; } /** * {@inheritdoc} */ - public function unserialize($serialized) { - $data = unserialize($serialized); - $entity_type = $data['entityType']; - unset($data['entityType']); - $this->__construct($data, $entity_type); + public function __wakeup() { + // Run the values from getExportProperties() through __construct(). + $values = array_intersect_key($this->getExportProperties(), get_object_vars($this)); + $this->__construct($values, $this->entityTypeId); } }