class ConfigEntityNormalizer in Drupal 9
Same name and namespace in other branches
- 8 core/modules/serialization/src/Normalizer/ConfigEntityNormalizer.php \Drupal\serialization\Normalizer\ConfigEntityNormalizer
Normalizes/denormalizes Drupal config entity objects into an array structure.
Hierarchy
- class \Drupal\serialization\Normalizer\NormalizerBase implements \Symfony\Component\Serializer\SerializerAwareInterface, CacheableNormalizerInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer
- class \Drupal\serialization\Normalizer\EntityNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface uses FieldableEntityNormalizerTrait
- class \Drupal\serialization\Normalizer\ConfigEntityNormalizer
- class \Drupal\serialization\Normalizer\EntityNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface uses FieldableEntityNormalizerTrait
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer
Expanded class hierarchy of ConfigEntityNormalizer
2 files declare their use of ConfigEntityNormalizer
- ConfigEntityNormalizerTest.php in core/
modules/ serialization/ tests/ src/ Unit/ Normalizer/ ConfigEntityNormalizerTest.php - LayoutEntityDisplayNormalizer.php in core/
modules/ layout_builder/ src/ Normalizer/ LayoutEntityDisplayNormalizer.php
1 string reference to 'ConfigEntityNormalizer'
- serialization.services.yml in core/
modules/ serialization/ serialization.services.yml - core/modules/serialization/serialization.services.yml
1 service uses ConfigEntityNormalizer
- serializer.normalizer.config_entity in core/
modules/ serialization/ serialization.services.yml - Drupal\serialization\Normalizer\ConfigEntityNormalizer
File
- core/
modules/ serialization/ src/ Normalizer/ ConfigEntityNormalizer.php, line 10
Namespace
Drupal\serialization\NormalizerView source
class ConfigEntityNormalizer extends EntityNormalizer {
/**
* {@inheritdoc}
*/
protected $supportedInterfaceOrClass = ConfigEntityInterface::class;
/**
* {@inheritdoc}
*/
public function normalize($object, $format = NULL, array $context = []) {
return static::getDataWithoutInternals($object
->toArray());
}
/**
* {@inheritdoc}
*/
public function denormalize($data, $class, $format = NULL, array $context = []) {
return parent::denormalize(static::getDataWithoutInternals($data), $class, $format, $context);
}
/**
* Gets the given data without the internal implementation details.
*
* @param array $data
* The data that is either currently or about to be stored in configuration.
*
* @return array
* The same data, but without internals. Currently, that is only the '_core'
* key, which is reserved by Drupal core to handle complex edge cases
* correctly. Data in the '_core' key is irrelevant to clients reading
* configuration, and is not allowed to be set by clients writing
* configuration: it is for Drupal core only, and managed by Drupal core.
*
* @see https://www.drupal.org/node/2653358
*/
protected static function getDataWithoutInternals(array $data) {
return array_diff_key($data, [
'_core' => TRUE,
]);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CacheableNormalizerInterface:: |
constant | Name of key for bubbling cacheability metadata via serialization context. | ||
ConfigEntityNormalizer:: |
protected | property |
The interface or class that this Normalizer supports. Overrides EntityNormalizer:: |
1 |
ConfigEntityNormalizer:: |
public | function |
Overrides EntityNormalizer:: |
|
ConfigEntityNormalizer:: |
protected static | function | Gets the given data without the internal implementation details. | 1 |
ConfigEntityNormalizer:: |
public | function |
Overrides ComplexDataNormalizer:: |
|
EntityNormalizer:: |
public | function | Constructs an EntityNormalizer object. | |
FieldableEntityNormalizerTrait:: |
protected | property | The entity field manager. | |
FieldableEntityNormalizerTrait:: |
protected | property | The entity type manager. | 1 |
FieldableEntityNormalizerTrait:: |
protected | property | The entity type repository. | |
FieldableEntityNormalizerTrait:: |
protected | function | Build the field item value using the incoming data. | 7 |
FieldableEntityNormalizerTrait:: |
protected | function | Denormalizes entity data by denormalizing each field individually. | |
FieldableEntityNormalizerTrait:: |
protected | function | Determines the entity type ID to denormalize as. | |
FieldableEntityNormalizerTrait:: |
protected | function | Denormalizes the bundle property so entity creation can use it. | |
FieldableEntityNormalizerTrait:: |
protected | function | Returns the entity field manager. | |
FieldableEntityNormalizerTrait:: |
protected | function | Gets the entity type definition. | |
FieldableEntityNormalizerTrait:: |
protected | function | Returns the entity type manager. | |
FieldableEntityNormalizerTrait:: |
protected | function | Returns the entity type repository. | |
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. | 1 |
NormalizerBase:: |
public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 |
NormalizerBase:: |
public | function | 1 |