protected function DataDefinitionDatetimeNormalizer::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
Overrides DataDefinitionNormalizer::extractPropertyData
File
- src/
Normalizer/ DataDefinitionDatetimeNormalizer.php, line 20
Class
- DataDefinitionDatetimeNormalizer
- Data definition normalizer.
Namespace
Drupal\jsonapi_schema\NormalizerCode
protected function extractPropertyData(DataDefinitionInterface $property, array $context = []) {
$value = parent::extractPropertyData($property);
$value['type'] = 'string';
$value['format'] = 'date';
return $value;
}