protected function FieldNormalizer::normalizeFieldItems in Drupal 8
Same name in this branch
- 8 core/modules/jsonapi/src/Normalizer/FieldNormalizer.php \Drupal\jsonapi\Normalizer\FieldNormalizer::normalizeFieldItems()
- 8 core/modules/hal/src/Normalizer/FieldNormalizer.php \Drupal\hal\Normalizer\FieldNormalizer::normalizeFieldItems()
Same name and namespace in other branches
- 9 core/modules/hal/src/Normalizer/FieldNormalizer.php \Drupal\hal\Normalizer\FieldNormalizer::normalizeFieldItems()
Helper function to normalize field items.
Parameters
\Drupal\Core\Field\FieldItemListInterface $field_items: The field item list object.
string $format: The format.
array $context: The context array.
Return value
array The array of normalized field items.
1 call to FieldNormalizer::normalizeFieldItems()
- FieldNormalizer::normalize in core/
modules/ hal/ src/ Normalizer/ FieldNormalizer.php - Normalizes an object into a set of arrays/scalars.
File
- core/
modules/ hal/ src/ Normalizer/ FieldNormalizer.php, line 64
Class
- FieldNormalizer
- Converts the Drupal field structure to HAL array structure.
Namespace
Drupal\hal\NormalizerCode
protected function normalizeFieldItems($field_items, $format, $context) {
$normalized_field_items = [];
if (!$field_items
->isEmpty()) {
foreach ($field_items as $field_item) {
$normalized_field_items[] = $this->serializer
->normalize($field_item, $format, $context);
}
}
return $normalized_field_items;
}