class TextItemNormalizer in Content Synchronization 8.2
Same name and namespace in other branches
- 3.0.x src/Normalizer/TextItemNormalizer.php \Drupal\content_sync\Normalizer\TextItemNormalizer
Converts TextItem fields to an array including computed values.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\content_sync\Normalizer\TextItemNormalizer
Expanded class hierarchy of TextItemNormalizer
1 string reference to 'TextItemNormalizer'
1 service uses TextItemNormalizer
File
- src/
Normalizer/ TextItemNormalizer.php, line 10
Namespace
Drupal\content_sync\NormalizerView source
class TextItemNormalizer extends NormalizerBase {
/**
* The interface or class that this Normalizer supports.
*
* @var string
*/
protected $supportedInterfaceOrClass = 'Drupal\\text\\Plugin\\Field\\FieldType\\TextItemBase';
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = []) {
$attributes = [];
foreach ($object
->getProperties(TRUE) as $name => $field) {
$value = $this->serializer
->normalize($field, $format, $context);
if (is_object($value)) {
$value = $this->serializer
->normalize($value, $format, $context);
}
$attributes[$name] = $value;
}
return $attributes;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableNormalizerInterface:: |
constant | Name of key for bubbling cacheability metadata via serialization context. | ||
NormalizerBase:: |
protected | property | List of formats which supports (de-)normalization. | 3 |
NormalizerBase:: |
protected | function | Adds cacheability if applicable. | |
NormalizerBase:: |
protected | function | Checks if the provided format is supported by this normalizer. | 2 |
NormalizerBase:: |
public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 |
NormalizerBase:: |
public | function | Checks whether the given class is supported for normalization by this normalizer. | 1 |
TextItemNormalizer:: |
protected | property |
The interface or class that this Normalizer supports. Overrides NormalizerBase:: |
|
TextItemNormalizer:: |
public | function | Normalizes an object into a set of arrays/scalars. |