function ListNormalizer::normalize

1 method overrides ListNormalizer::normalize()
FieldNormalizer::normalize in core/modules/hal/src/Normalizer/FieldNormalizer.php

File

core/modules/serialization/src/Normalizer/ListNormalizer.php, line 26

Class

ListNormalizer
Converts list objects to arrays.

Namespace

Drupal\serialization\Normalizer

Code

public function normalize($object, $format = NULL, array $context = []) {
  $attributes = [];
  foreach ($object as $fieldItem) {
    $attributes[] = $this->serializer
      ->normalize($fieldItem, $format, $context);
  }
  return $attributes;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.