class FieldNormalizer extends FieldNormalizer (View source)

Converts the Drupal field structure to HAL array structure.

Traits

SerializerAwareTrait

Properties

protected $supportedInterfaceOrClass {@inheritdoc} from  FieldNormalizer
protected $format {@inheritdoc}

Methods

bool
supportsNormalization($data, $format = NULL)

{@inheritdoc}

supportsDenormalization($data, $type, $format = NULL)

Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()

bool
checkFormat(string $format = NULL)

Checks if the provided format is supported by this normalizer.

addCacheableDependency(array $context, $data)

Adds cacheability if applicable.

bool
hasCacheableSupportsMethod()

{@inheritdoc}

array|string|int|float|bool|ArrayObject|null
normalize($field_items, $format = NULL, array $context = [])

{@inheritdoc}

mixed
denormalize($data, $class, $format = NULL, array $context = [])

{@inheritdoc}

array
normalizeFieldItems(FieldItemListInterface $field_items, string $format, array $context)

Helper function to normalize field items.

Details

bool supportsNormalization($data, $format = NULL)

{@inheritdoc}

Parameters

$data
$format

Return Value

bool

supportsDenormalization($data, $type, $format = NULL)

Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization()

This class doesn't implement DenormalizerInterface, but most of its child classes do. Therefore, this method is implemented at this level to reduce code duplication.

Parameters

$data
$type
$format

protected bool checkFormat(string $format = NULL)

Checks if the provided format is supported by this normalizer.

Parameters

string $format

The format to check.

Return Value

bool

TRUE if the format is supported, FALSE otherwise. If no format is specified this will return TRUE.

protected addCacheableDependency(array $context, $data)

Adds cacheability if applicable.

Parameters

array $context

Context options for the normalizer.

$data

The data that might have cacheability information.

bool hasCacheableSupportsMethod()

{@inheritdoc}

Return Value

bool

array|string|int|float|bool|ArrayObject|null normalize($field_items, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$field_items
$format
array $context

Return Value

array|string|int|float|bool|ArrayObject|null

mixed denormalize($data, $class, $format = NULL, array $context = [])

{@inheritdoc}

Parameters

$data
$class
$format
array $context

Return Value

mixed

protected array normalizeFieldItems(FieldItemListInterface $field_items, string $format, array $context)

Helper function to normalize field items.

Parameters

FieldItemListInterface $field_items

The field item list object.

string $format

The format.

array $context

The context array.

Return Value

array

The array of normalized field items.