core/modules/hal/hal.services.yml | 4 +--- core/modules/hal/src/Normalizer/FieldItemNormalizer.php | 8 +++++++- core/modules/hal/src/Normalizer/TimestampItemNormalizer.php | 2 ++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/modules/hal/hal.services.yml b/core/modules/hal/hal.services.yml index b2c898f..66cf5ba 100644 --- a/core/modules/hal/hal.services.yml +++ b/core/modules/hal/hal.services.yml @@ -19,9 +19,7 @@ services: arguments: ['@entity.manager', '@http_client', '@hal.link_manager', '@module_handler'] serializer.normalizer.timestamp_item.hal: class: Drupal\hal\Normalizer\TimestampItemNormalizer - tags: - # Priority must be higher than serializer.normalizer.field_item.hal. - - { name: normalizer, priority: 20, bc: bc_timestamp_normalizer_unix, bc_config_name: 'serialization.settings' } + deprecated: The "%service_id% service is deprecated in 8.5.0, use the serializer.normalizer.timestamp service instead. serializer.normalizer.entity.hal: class: Drupal\hal\Normalizer\ContentEntityNormalizer arguments: ['@hal.link_manager', '@entity.manager', '@module_handler'] diff --git a/core/modules/hal/src/Normalizer/FieldItemNormalizer.php b/core/modules/hal/src/Normalizer/FieldItemNormalizer.php index 6d10b06..7b5db31 100644 --- a/core/modules/hal/src/Normalizer/FieldItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/FieldItemNormalizer.php @@ -93,7 +93,13 @@ protected function normalizedFieldValues(FieldItemInterface $field_item, $format // if needed. /** @var \Drupal\Core\TypedData\TypedDataInterface $property */ foreach (TypedDataInternalPropertiesHelper::getNonInternalProperties($field_item) as $property_name => $property) { - $normalized[$property_name] = $this->serializer->normalize($property, $format, $context); + $normalized_property = $this->serializer->normalize($property, $format, $context);; + if (is_array($normalized_property)) { + $normalized += $normalized_property; + } + else { + $normalized[$property_name] = $normalized_property; + } } if (isset($context['langcode'])) { diff --git a/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php b/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php index c389e79..78ec5a3 100644 --- a/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/TimestampItemNormalizer.php @@ -8,6 +8,8 @@ /** * Converts values for TimestampItem to and from common formats for hal. + * + * @deprecated in 8.5.0, use \Drupal\serialization\Normalizer\TimestampNormalizer instead. */ class TimestampItemNormalizer extends FieldItemNormalizer {