class ConfigEntityNormalizer
Same name in other branches
- 8.9.x core/modules/serialization/src/Normalizer/ConfigEntityNormalizer.php \Drupal\serialization\Normalizer\ConfigEntityNormalizer
- 10 core/modules/serialization/src/Normalizer/ConfigEntityNormalizer.php \Drupal\serialization\Normalizer\ConfigEntityNormalizer
- 11.x 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, \Drupal\serialization\Normalizer\CacheableNormalizerInterface, \Symfony\Component\Serializer\Normalizer\CacheableSupportsMethodInterface uses \Symfony\Component\Serializer\SerializerAwareTrait
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer extends \Drupal\serialization\Normalizer\NormalizerBase
- class \Drupal\serialization\Normalizer\EntityNormalizer extends \Drupal\serialization\Normalizer\ComplexDataNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface uses \Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait
- class \Drupal\serialization\Normalizer\ConfigEntityNormalizer extends \Drupal\serialization\Normalizer\EntityNormalizer
- class \Drupal\serialization\Normalizer\EntityNormalizer extends \Drupal\serialization\Normalizer\ComplexDataNormalizer implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface uses \Drupal\serialization\Normalizer\FieldableEntityNormalizerTrait
- class \Drupal\serialization\Normalizer\ComplexDataNormalizer extends \Drupal\serialization\Normalizer\NormalizerBase
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
Title Sort descending | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|
CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY | constant | Name of key for bubbling cacheability metadata via serialization context. | |||
ComplexDataNormalizer::hasCacheableSupportsMethod | public | function | Overrides NormalizerBase::hasCacheableSupportsMethod | 1 | |
ConfigEntityNormalizer::$supportedInterfaceOrClass | protected | property | The interface or class that this Normalizer supports. | Overrides EntityNormalizer::$supportedInterfaceOrClass | 1 |
ConfigEntityNormalizer::denormalize | public | function | Overrides EntityNormalizer::denormalize | ||
ConfigEntityNormalizer::getDataWithoutInternals | protected static | function | Gets the given data without the internal implementation details. | 1 | |
ConfigEntityNormalizer::normalize | public | function | Overrides ComplexDataNormalizer::normalize | ||
EntityNormalizer::__construct | public | function | Constructs an EntityNormalizer object. | ||
FieldableEntityNormalizerTrait::$entityFieldManager | protected | property | The entity field manager. | ||
FieldableEntityNormalizerTrait::$entityTypeManager | protected | property | The entity type manager. | 1 | |
FieldableEntityNormalizerTrait::$entityTypeRepository | protected | property | The entity type repository. | ||
FieldableEntityNormalizerTrait::constructValue | protected | function | Build the field item value using the incoming data. | 7 | |
FieldableEntityNormalizerTrait::denormalizeFieldData | protected | function | Denormalizes entity data by denormalizing each field individually. | ||
FieldableEntityNormalizerTrait::determineEntityTypeId | protected | function | Determines the entity type ID to denormalize as. | ||
FieldableEntityNormalizerTrait::extractBundleData | protected | function | Denormalizes the bundle property so entity creation can use it. | ||
FieldableEntityNormalizerTrait::getEntityFieldManager | protected | function | Returns the entity field manager. | ||
FieldableEntityNormalizerTrait::getEntityTypeDefinition | protected | function | Gets the entity type definition. | ||
FieldableEntityNormalizerTrait::getEntityTypeManager | protected | function | Returns the entity type manager. | ||
FieldableEntityNormalizerTrait::getEntityTypeRepository | protected | function | Returns the entity type repository. | ||
NormalizerBase::$format | protected | property | List of formats which supports (de-)normalization. | 3 | |
NormalizerBase::addCacheableDependency | protected | function | Adds cacheability if applicable. | ||
NormalizerBase::checkFormat | protected | function | Checks if the provided format is supported by this normalizer. | 1 | |
NormalizerBase::supportsDenormalization | public | function | Implements \Symfony\Component\Serializer\Normalizer\DenormalizerInterface::supportsDenormalization() | 1 | |
NormalizerBase::supportsNormalization | public | function | 1 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.