.../Functional/EntityResource/EntityResourceTestBase.php | 15 --------------- .../field_normalization_test.services.yml | 4 ++-- .../text/src/Plugin/Field/FieldType/TextItemBase.php | 2 +- core/modules/text/src/TextProcessed.php | 16 ++++++++++++---- 4 files changed, 15 insertions(+), 22 deletions(-) diff --git a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php index 8a0a5e9..6faf028 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/EntityResourceTestBase.php @@ -1365,19 +1365,4 @@ protected function assertResourceNotAvailable(Url $url, array $request_options) } } - /** - * Sorts a nested array with ksort(). - * - * @param $array - * The nested array to sort. - */ - public static function nestedKsort(&$array) { - ksort($array); - foreach ($array as &$item) { - if (is_array($item)) { - static::nestedKsort($item); - } - } - } - } diff --git a/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml b/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml index 51fdd4a..36243e7 100644 --- a/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml +++ b/core/modules/serialization/tests/modules/field_normalization_test/field_normalization_test.services.yml @@ -2,5 +2,5 @@ services: serializer.normalizer.silly_fielditem: class: Drupal\field_normalization_test\Normalization\TextItemSillyNormalizer tags: - # The priority must be higher than serializer.normalizer.text_item_base. - - { name: normalizer , priority: 30 } + # The priority must be higher than serialization.normalizer.field_item. + - { name: normalizer , priority: 9 } diff --git a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php index 144d869..a873421 100644 --- a/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php +++ b/core/modules/text/src/Plugin/Field/FieldType/TextItemBase.php @@ -60,7 +60,7 @@ public function isEmpty() { public function onChange($property_name, $notify = TRUE) { // Unset processed properties that are affected by the change. foreach ($this->definition->getPropertyDefinitions() as $property => $definition) { - if (in_array($definition->getClass(), [TextProcessed::class, TextProcessedResult::class], TRUE)) { + if ($definition->getClass() == '\Drupal\text\TextProcessed') { if ($property_name == 'format' || ($definition->getSetting('text source') == $property_name)) { $this->writePropertyValue($property, NULL); } diff --git a/core/modules/text/src/TextProcessed.php b/core/modules/text/src/TextProcessed.php index adbf39e..276c8ae 100644 --- a/core/modules/text/src/TextProcessed.php +++ b/core/modules/text/src/TextProcessed.php @@ -84,19 +84,27 @@ public function setValue($value, $notify = TRUE) { } } + /** + * @return string[] + */ public function getCacheTags() { - $this->getValue(); + $this->ensureComputedValue(); return $this->processed->getCacheTags(); } - + /** + * {@inheritdoc} + */ public function getCacheContexts() { - $this->getValue(); + $this->ensureComputedValue(); return $this->processed->getCacheContexts(); } + /** + * {@inheritdoc} + */ public function getCacheMaxAge() { - $this->getValue(); + $this->ensureComputedValue(); return $this->processed->getCacheMaxAge(); }