protected function FieldNormalizer::normalizeFieldItems

Helper function to normalize field items.

Parameters

\Drupal\Core\Entity\Field\FieldInterface $field: The field object.

string $format: The format.

array $context: The context array.

Return value

array The array of normalized field items.

1 call to FieldNormalizer::normalizeFieldItems()

File

drupal/core/modules/hal/lib/Drupal/hal/Normalizer/FieldNormalizer.php, line 102
Contains \Drupal\hal\Normalizer\FieldNormalizer.

Class

FieldNormalizer
Converts the Drupal field structure to HAL array structure.

Namespace

Drupal\hal\Normalizer

Code

protected function normalizeFieldItems($field, $format, $context) {
  $normalized_field_items = array();
  if (!$field
    ->isEmpty()) {
    foreach ($field as $field_item) {
      $normalized_field_items[] = $this->serializer
        ->normalize($field_item, $format, $context);
    }
  }
  return $normalized_field_items;
}