diff --git a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php index 7bee5d3..a8eb5ad 100644 --- a/core/lib/Drupal/Core/Entity/EntityBCDecorator.php +++ b/core/lib/Drupal/Core/Entity/EntityBCDecorator.php @@ -87,7 +87,7 @@ public function getBCEntity() { public function &__get($name) { // Directly return the original property. if ($name == 'original') { - return $this->values[$name]; + return $this->decorated->values[$name]; } // We access the protected 'values' and 'fields' properties of the decorated @@ -187,12 +187,17 @@ public function __isset($name) { if (($isset = isset($value)) && is_array($value)) { $isset = FALSE; foreach ($value as $langcode => $data) { - foreach ($data as $delta => $value) { - if (!is_null($value)) { - $isset = TRUE; - break(2); + if (is_array($data)) { + foreach ($data as $delta => $value) { + if (!is_null($value)) { + $isset = TRUE; + break(2); + } } } + else { + $isset = !empty($data); + } } } return $isset; diff --git a/core/lib/Drupal/Core/Entity/EntityNG.php b/core/lib/Drupal/Core/Entity/EntityNG.php index 634e5cc..4340882 100644 --- a/core/lib/Drupal/Core/Entity/EntityNG.php +++ b/core/lib/Drupal/Core/Entity/EntityNG.php @@ -49,6 +49,8 @@ class EntityNG extends Entity { */ protected $values = array( 'langcode' => array(LANGUAGE_DEFAULT => array(0 => array('value' => LANGUAGE_NOT_SPECIFIED))), + 'newRevision' => array(LANGUAGE_DEFAULT => array(0 => array('value' => FALSE))), + 'isDefaultRevision' => array(LANGUAGE_DEFAULT => array(0 => array('value' => TRUE))), ); /** @@ -101,6 +103,9 @@ public function getType() { protected function init() { // We unset all defined properties, so magic getters apply. unset($this->langcode); + unset($this->enforceIsNew); + unset($this->newRevision); + unset($this->isDefaultRevision); } /** diff --git a/core/modules/node/lib/Drupal/node/NodeStorageController.php b/core/modules/node/lib/Drupal/node/NodeStorageController.php index db32105..a4a758d 100644 --- a/core/modules/node/lib/Drupal/node/NodeStorageController.php +++ b/core/modules/node/lib/Drupal/node/NodeStorageController.php @@ -237,6 +237,18 @@ public function baseFieldDefinitions() { 'description' => t('The node language code.'), 'type' => 'language_field', ); + $properties['newRevision'] = array( + 'label' => t('New revision'), + 'description' => t('A boolean indicating whether this is a new revision.'), + 'type' => 'boolean_field', + 'queryable' => FALSE, + ); + $properties['isDefaultRevision'] = array( + 'label' => t('Default revision'), + 'description' => t('A boolean indicating whether this version is the default revision.'), + 'type' => 'boolean_field', + 'queryable' => FALSE, + ); $properties['title'] = array( 'label' => t('Title'), 'description' => t('The title of this node, always treated as non-markup plain text.'), diff --git a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php index e040baf..9a43fae 100644 --- a/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php +++ b/core/modules/node/lib/Drupal/node/Plugin/Core/Entity/Node.php @@ -193,18 +193,6 @@ class Node extends EntityNG implements ContentEntityInterface { public $revision_uid; /** - * The plain data values of the contained properties. - * - * Define default values. - * - * @var array - */ - protected $values = array( - 'langcode' => array(LANGUAGE_DEFAULT => array(0 => array('value' => LANGUAGE_NOT_SPECIFIED))), - 'isDefaultRevision' => array(LANGUAGE_DEFAULT => array(0 => array('value' => TRUE))), - ); - - /** * Overrides \Drupal\Core\Entity\EntityNG::init(). */ protected function init() { @@ -212,7 +200,6 @@ protected function init() { // We unset all defined properties, so magic getters apply. unset($this->nid); unset($this->vid); - unset($this->isDefaultRevision); unset($this->uuid); unset($this->type); unset($this->title);