diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php index 42ad63e..ec68ced 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php @@ -263,4 +263,27 @@ public function url($rel = 'edit-form', $options = array()) { return parent::url($rel, $options); } + /** + * Implements the magic __sleep() method. + * + * Using the Serialize interface and serialize() / unserialize() methods + * breaks entity forms in PHP 5.4. + * @todo Investigate in https://drupal.org/node/2074253. + */ + public function __sleep() { + // Only serialize properties from getExportProperties(). + $keys = array_keys($this->getExportProperties()); + $keys[] = 'entityTypeId'; + return $keys; + } + + /** + * Implements the magic __wakeup() method. + */ + 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); + } + } diff --git a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php index 611e28f..8afd2b7 100644 --- a/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php +++ b/core/modules/entity/lib/Drupal/entity/Entity/EntityFormDisplay.php @@ -145,23 +145,4 @@ public function getRenderer($field_name) { return $widget; } - /** - * {@inheritdoc} - */ - public function __sleep() { - // Only store the definition, not external objects or derived data. - $keys = array_keys($this->getExportProperties()); - $keys[] = 'entityTypeId'; - return $keys; - } - - /** - * {@inheritdoc} - */ - 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); - } - } diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php index da997b6..ec8266a 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldConfig.php @@ -690,27 +690,6 @@ public function hasData() { } /** - * Implements the magic __sleep() method. - * - * Using the Serialize interface and serialize() / unserialize() methods - * breaks entity forms in PHP 5.4. - * @todo Investigate in https://drupal.org/node/2074253. - */ - public function __sleep() { - // Only serialize properties from getExportProperties(). - return array_keys(array_intersect_key($this->getExportProperties(), get_object_vars($this))); - } - - /** - * Implements the magic __wakeup() method. - */ - public function __wakeup() { - // Run the values from getExportProperties() through __construct(). - $values = array_intersect_key($this->getExportProperties(), get_object_vars($this)); - $this->__construct($values); - } - - /** * {@inheritdoc} */ public static function createFromDataType($type) { diff --git a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php index 3c35bfb..d770ebf 100644 --- a/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php +++ b/core/modules/field/lib/Drupal/field/Entity/FieldInstanceConfig.php @@ -612,27 +612,6 @@ public function targetBundle() { return $this->bundle; } - /* - * Implements the magic __sleep() method. - * - * Using the Serialize interface and serialize() / unserialize() methods - * breaks entity forms in PHP 5.4. - * @todo Investigate in https://drupal.org/node/2074253. - */ - public function __sleep() { - // Only serialize properties from getExportProperties(). - return array_keys(array_intersect_key($this->getExportProperties(), get_object_vars($this))); - } - - /** - * Implements the magic __wakeup() method. - */ - public function __wakeup() { - // Run the values from getExportProperties() through __construct(). - $values = array_intersect_key($this->getExportProperties(), get_object_vars($this)); - $this->__construct($values); - } - /** * {@inheritdoc} */