class MetatagNormalizer in Replication 8
Normalizes metatag into the viewed entity.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\serialization\Normalizer\ListNormalizer
- class \Drupal\serialization\Normalizer\FieldNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface
- class \Drupal\replication\Normalizer\MetatagNormalizer
- class \Drupal\serialization\Normalizer\FieldNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface
- class \Drupal\serialization\Normalizer\ListNormalizer
Expanded class hierarchy of MetatagNormalizer
1 string reference to 'MetatagNormalizer'
1 service uses MetatagNormalizer
File
- src/
Normalizer/ MetatagNormalizer.php, line 10
Namespace
Drupal\replication\NormalizerView source
class MetatagNormalizer extends FieldNormalizer {
/**
* {@inheritdoc}
*/
protected $supportedInterfaceOrClass = 'Drupal\\metatag\\Plugin\\Field\\MetatagEntityFieldItemList';
/**
* @var string[]
*/
protected $format = [
'json',
];
/**
* {@inheritdoc}
*/
public function normalize($field_item, $format = NULL, array $context = []) {
$normalized = [];
if (\Drupal::hasService('metatag.normalizer.metatag')) {
$normalized = \Drupal::service('metatag.normalizer.metatag')
->normalize($field_item, $format, $context);
}
return [
$normalized,
];
}
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
return parent::denormalize($data, $class, $format, $context);
}
/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, $type, $format = NULL) {
if (in_array($type, [
'Drupal\\metatag\\Plugin\\Field\\MetatagEntityFieldItemList',
])) {
return TRUE;
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableNormalizerInterface:: |
constant | Name of key for bubbling cacheability metadata via serialization context. | ||
MetatagNormalizer:: |
protected | property |
Overrides NormalizerBase:: |
|
MetatagNormalizer:: |
protected | property |
The interface or class that this Normalizer supports. Overrides FieldNormalizer:: |
|
MetatagNormalizer:: |
public | function |
Denormalizes data back into an object of the given class. Overrides FieldNormalizer:: |
|
MetatagNormalizer:: |
public | function |
Normalizes an object into a set of arrays/scalars. Overrides ListNormalizer:: |
|
MetatagNormalizer:: |
public | function |
Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() Overrides NormalizerBase:: |
|
NormalizerBase:: |
protected | function | Adds cacheability if applicable. | |
NormalizerBase:: |
protected | function | Checks if the provided format is supported by this normalizer. | 2 |
NormalizerBase:: |
public | function | Checks whether the given class is supported for normalization by this normalizer. | 1 |