protected function normalizeFieldItems(FieldItemListInterface $field, $format, array $context) {

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

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

@param \Drupal\Core\Field\FieldItemListInterface $field
The field object.
@param string $format
The format.
@param array $context
The context array.

@return array
The array of normalized field items.
Helper function to normalize field items .