diff --git a/core/lib/Drupal/Core/Entity/ContentEntityBase.php b/core/lib/Drupal/Core/Entity/ContentEntityBase.php index aff5209..071f584 100644 --- a/core/lib/Drupal/Core/Entity/ContentEntityBase.php +++ b/core/lib/Drupal/Core/Entity/ContentEntityBase.php @@ -385,9 +385,10 @@ protected function getTranslatedField($name, $langcode) { * {@inheritdoc} */ public function set($name, $value, $notify = TRUE) { - $this->get($name)->setValue($value, FALSE); - // Directly notify ourselves, so we can take changes into account. - $this->onChange($name); + // Assign the value on the child and overrule notify such that we get + // notified to handle changes afterwards. We can ignore notify as there is + // no parent to notify anyway. + $this->get($name)->setValue($value, TRUE); } /** diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php index b7fa954..44063ad 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php @@ -140,9 +140,9 @@ public static function schema(FieldStorageDefinitionInterface $field_definition) * {@inheritdoc} */ public function setValue($values, $notify = TRUE) { - // Treat the values as property value of the entity property, if no array - // is given as this handles entity ids and objects. if (isset($values) && !is_array($values)) { + // If either a scalar or an object was passed as the value for the item, + // assign it to the 'entity' property since that works for both cases. $this->set('entity', $values, $notify); } else { diff --git a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php index 17b7ef0..972b6e2 100644 --- a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php +++ b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php @@ -64,7 +64,7 @@ public function onChange($property_name, $notify = TRUE) { foreach ($this->definition->getPropertyDefinitions() as $property => $definition) { if ($definition->getClass() == '\Drupal\text\TextProcessed') { if ($property_name == 'format' || ($definition->getSetting('text source') == $property_name)) { - $this->set($property, NULL, FALSE); + $this->writePropertyValue($property, NULL); } } }