diff --git a/core/lib/Drupal/Core/TypedData/Type/Map.php b/core/lib/Drupal/Core/TypedData/Type/Map.php index 345c773..1c11a2e 100644 --- a/core/lib/Drupal/Core/TypedData/Type/Map.php +++ b/core/lib/Drupal/Core/TypedData/Type/Map.php @@ -194,7 +194,8 @@ public function getPropertyDefinition($name) { */ public function isEmpty() { foreach ($this->properties as $property) { - if ($property->getValue() !== NULL) { + $definition = $property->getDefinition(); + if (empty($definition['computed']) && $property->getValue() !== NULL) { return FALSE; } } diff --git a/core/modules/comment/lib/Drupal/comment/FieldNewItem.php b/core/modules/comment/lib/Drupal/comment/FieldNewItem.php index 7ef4092..73fabe5 100644 --- a/core/modules/comment/lib/Drupal/comment/FieldNewItem.php +++ b/core/modules/comment/lib/Drupal/comment/FieldNewItem.php @@ -33,6 +33,7 @@ public function getPropertyDefinitions() { 'type' => 'integer', 'label' => t('Integer value'), 'class' => '\Drupal\comment\FieldNewValue', + 'computed' => TRUE, ); } return static::$propertyDefinitions; diff --git a/core/modules/comment/lib/Drupal/comment/FieldNewValue.php b/core/modules/comment/lib/Drupal/comment/FieldNewValue.php index 9fc5cae..8f9c392 100644 --- a/core/modules/comment/lib/Drupal/comment/FieldNewValue.php +++ b/core/modules/comment/lib/Drupal/comment/FieldNewValue.php @@ -21,7 +21,7 @@ class FieldNewValue extends TypedData { /** * Implements \Drupal\Core\TypedData\TypedDataInterface::getValue(). */ - public function getValue($langcode = NULL) { + public function getValue() { if (!isset($this->value)) { if (!isset($this->parent)) { throw new InvalidArgumentException('Computed properties require context for computation.');