You are here

public function TextItemNormalizer::normalize in Content Synchronization 3.0.x

Same name and namespace in other branches
  1. 8.2 src/Normalizer/TextItemNormalizer.php \Drupal\content_sync\Normalizer\TextItemNormalizer::normalize()

File

src/Normalizer/TextItemNormalizer.php, line 22

Class

TextItemNormalizer
Converts TextItem fields to an array including computed values.

Namespace

Drupal\content_sync\Normalizer

Code

public function normalize($object, $format = NULL, array $context = []) {
  $attributes = [];
  foreach ($object
    ->getProperties(TRUE) as $name => $field) {
    $value = $this->serializer
      ->normalize($field, $format, $context);
    if (is_object($value)) {
      $value = $this->serializer
        ->normalize($value, $format, $context);
    }
    $attributes[$name] = $value;
  }
  return $attributes;
}