protected function DataDefinitionNormalizer::extractPropertyData in JSON:API Schema 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
8 calls to DataDefinitionNormalizer::extractPropertyData()
- ComplexDataDefinitionNormalizer::normalize in src/
Normalizer/ ComplexDataDefinitionNormalizer.php - DataDefinitionDatetimeNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionDatetimeNormalizer.php - Extracts property details from a data definition.
- DataDefinitionEmailNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionEmailNormalizer.php - Extracts property details from a data definition.
- DataDefinitionEntityReferenceNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionEntityReferenceNormalizer.php - Extracts property details from a data definition.
- DataDefinitionNormalizer::normalize in src/
Normalizer/ DataDefinitionNormalizer.php
6 methods override DataDefinitionNormalizer::extractPropertyData()
- DataDefinitionDatetimeNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionDatetimeNormalizer.php - Extracts property details from a data definition.
- DataDefinitionEmailNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionEmailNormalizer.php - Extracts property details from a data definition.
- DataDefinitionEntityReferenceNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionEntityReferenceNormalizer.php - Extracts property details from a data definition.
- DataDefinitionStringNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionStringNormalizer.php - Extracts property details from a data definition.
- DataDefinitionTimestampNormalizer::extractPropertyData in src/
Normalizer/ DataDefinitionTimestampNormalizer.php - Extracts property details from a data definition.
File
- src/
Normalizer/ DataDefinitionNormalizer.php, line 108
Class
- DataDefinitionNormalizer
- Normalizer for DataDefinitionInterface instances.
Namespace
Drupal\jsonapi_schema\NormalizerCode
protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
$value = [
'type' => $property
->getDataType(),
];
if ($item = $property
->getLabel()) {
$value['title'] = $item;
}
if ($item = $property
->getDescription()) {
$value['description'] = addslashes(strip_tags($item));
}
return $value;
}