FieldCollectionItemNormalizer.php in Field collection 8
Same filename and directory in other branches
Namespace
Drupal\field_collection\NormalizerFile
src/Normalizer/FieldCollectionItemNormalizer.phpView source
<?php
namespace Drupal\field_collection\Normalizer;
use Drupal\serialization\Normalizer\ComplexDataNormalizer;
use Drupal\field_collection\Plugin\Field\FieldType\FieldCollection;
/**
* Adds field collection items to field collections.
*/
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;
}
}
Classes
Name | Description |
---|---|
FieldCollectionItemNormalizer | Adds field collection items to field collections. |