function FieldItemNormalizer::normalize
Same name in this branch
- 8.9.x core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php \Drupal\jsonapi\Normalizer\FieldItemNormalizer::normalize()
Same name in other branches
- 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()
- 10 core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php \Drupal\jsonapi\Normalizer\FieldItemNormalizer::normalize()
- 11.x core/modules/jsonapi/src/Normalizer/FieldItemNormalizer.php \Drupal\jsonapi\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),
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.