You are here

public function EntityReferenceQuantityItemNormalizer::normalize in Replication 8

Overrides EntityReferenceItemNormalizer::normalize

File

src/Normalizer/EntityReferenceQuantityItemNormalizer.php, line 27

Class

EntityReferenceQuantityItemNormalizer
Normalizer for entity_reference_quantity field type.

Namespace

Drupal\replication\Normalizer

Code

public function normalize($field, $format = NULL, array $context = []) {
  $field_info = parent::normalize($field, $format, $context);
  $value = $field
    ->getValue();
  $field_info['quantity'] = $value['quantity'];
  return $field_info;
}