public function FieldItemNormalizer::normalize in Drupal 9
Same name in this branch
- 9 core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php \Drupal\jsonapi\Normalizer\FieldItemNormalizer::normalize()
- 9 core/modules/hal/src/Normalizer/FieldItemNormalizer.php \Drupal\hal\Normalizer\FieldItemNormalizer::normalize()
Same name and namespace in other branches
- 8 core/modules/hal/src/Normalizer/FieldItemNormalizer.php \Drupal\hal\Normalizer\FieldItemNormalizer::normalize()
1 call to FieldItemNormalizer::normalize()
- EntityReferenceItemNormalizer::normalize in core/
modules/ hal/ src/ Normalizer/ EntityReferenceItemNormalizer.php
1 method overrides FieldItemNormalizer::normalize()
- EntityReferenceItemNormalizer::normalize in core/
modules/ hal/ src/ Normalizer/ EntityReferenceItemNormalizer.php
File
- core/
modules/ hal/ src/ Normalizer/ FieldItemNormalizer.php, line 27
Class
- FieldItemNormalizer
- Converts the Drupal field item object structure to HAL array structure.
Namespace
Drupal\hal\NormalizerCode
public function normalize($field_item, $format = NULL, array $context = []) {
// The values are wrapped in an array, and then wrapped in another array
// keyed by field name so that field items can be merged by the
// FieldNormalizer. This is necessary for the EntityReferenceItemNormalizer
// to be able to place values in the '_links' array.
$field = $field_item
->getParent();
return [
$field
->getName() => [
$this
->normalizedFieldValues($field_item, $format, $context),
],
];
}