public function ComplexDataDefinitionNormalizer::normalize in Schemata 8
Same name in this branch
- 8 schemata_json_schema/src/Normalizer/jsonapi/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\jsonapi\ComplexDataDefinitionNormalizer::normalize()
- 8 schemata_json_schema/src/Normalizer/json/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\json\ComplexDataDefinitionNormalizer::normalize()
- 8 schemata_json_schema/src/Normalizer/hal/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\hal\ComplexDataDefinitionNormalizer::normalize()
Overrides ComplexDataDefinitionNormalizer::normalize
File
- schemata_json_schema/
src/ Normalizer/ hal/ ComplexDataDefinitionNormalizer.php, line 29
Class
- ComplexDataDefinitionNormalizer
- Normalizer for ComplexDataDefinitionInterface for HAL.
Namespace
Drupal\schemata_json_schema\Normalizer\halCode
public function normalize($entity, $format = NULL, array $context = []) {
/* @var $entity \Drupal\Core\TypedData\ComplexDataDefinitionInterface */
// If this does not wrap a reference, revert to standard JSON behavior.
if (!$this
->isReferenceField($entity, $context)) {
return parent::normalize($entity, $format, $context);
}
// Not overriding the $context['parent'] here allows trickle-down of
// top-level field labels. However, we do need some of the field settings.
$context['settings'] = $entity
->getSettings();
return $this->serializer
->normalize($entity
->getPropertyDefinition('entity'), $format, $context);
}