You are here

protected function DataDefinitionNormalizer::extractPropertyData in Schemata 8

Extracts property details from a data definition.

This method includes mapping primitive types in Drupal to JSON Schema type and format descriptions. This method is invoked by several of the normalizers.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $property: The data definition from which to extract values.

array $context: Serializer context.

Return value

array Discrete values of the property definition

7 calls to DataDefinitionNormalizer::extractPropertyData()
ComplexDataDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/json/ComplexDataDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.
ComplexDataDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/jsonapi/ComplexDataDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.
DataDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/json/DataDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.
DataReferenceDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/json/DataReferenceDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.
DataReferenceDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/hal/DataReferenceDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.

... See full list

File

schemata_json_schema/src/Normalizer/json/DataDefinitionNormalizer.php, line 84

Class

DataDefinitionNormalizer
Normalizer for DataDefinitionInterface instances.

Namespace

Drupal\schemata_json_schema\Normalizer\json

Code

protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
  return \Drupal::service('plugin.manager.schemata_json_schema.type_mapper')
    ->createInstance($property
    ->getDataType())
    ->getMappedValue($property);
}