You are here

class FieldCollectionItemNormalizer in Field collection 8.3

Same name and namespace in other branches
  1. 8 src/Normalizer/FieldCollectionItemNormalizer.php \Drupal\field_collection\Normalizer\FieldCollectionItemNormalizer

Adds field collection items to field collections.

Hierarchy

Expanded class hierarchy of FieldCollectionItemNormalizer

1 string reference to 'FieldCollectionItemNormalizer'
field_collection.services.yml in ./field_collection.services.yml
field_collection.services.yml
1 service uses FieldCollectionItemNormalizer
field_collection.normalizer.field_collection_item in ./field_collection.services.yml
Drupal\field_collection\Normalizer\FieldCollectionItemNormalizer

File

src/Normalizer/FieldCollectionItemNormalizer.php, line 11

Namespace

Drupal\field_collection\Normalizer
View source
class FieldCollectionItemNormalizer extends ComplexDataNormalizer {

  /**
   * The interface or class that this Normalizer supports.
   *
   * @var string
   */
  protected $supportedInterfaceOrClass = FieldCollection::class;

  /**
   * {@inheritdoc}
   */
  public function normalize($field_item, $format = NULL, array $context = []) {

    // Set the normalized field output to the field collection item.
    $values = $this->serializer
      ->normalize($field_item
      ->getFieldCollectionItem(), $format, $context);
    return $values;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY constant Name of key for bubbling cacheability metadata via serialization context.
FieldCollectionItemNormalizer::$supportedInterfaceOrClass protected property The interface or class that this Normalizer supports. Overrides ComplexDataNormalizer::$supportedInterfaceOrClass
FieldCollectionItemNormalizer::normalize public function Normalizes an object into a set of arrays/scalars. Overrides ComplexDataNormalizer::normalize
NormalizerBase::$format protected property List of formats which supports (de-)normalization. 3
NormalizerBase::addCacheableDependency protected function Adds cacheability if applicable.
NormalizerBase::checkFormat protected function Checks if the provided format is supported by this normalizer. 2
NormalizerBase::supportsDenormalization public function Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() 1
NormalizerBase::supportsNormalization public function Checks whether the given class is supported for normalization by this normalizer. 1