ComplexDataDefinitionNormalizer.php in Schemata 8
File
schemata_json_schema/src/Normalizer/hal/ComplexDataDefinitionNormalizer.php
View source
<?php
namespace Drupal\schemata_json_schema\Normalizer\hal;
use Drupal\schemata_json_schema\Normalizer\json\ComplexDataDefinitionNormalizer as JsonComplexDataDefinitionNormalizer;
class ComplexDataDefinitionNormalizer extends JsonComplexDataDefinitionNormalizer {
protected $format = 'schema_json';
protected $describedFormat = 'hal_json';
public function normalize($entity, $format = NULL, array $context = []) {
if (!$this
->isReferenceField($entity, $context)) {
return parent::normalize($entity, $format, $context);
}
$context['settings'] = $entity
->getSettings();
return $this->serializer
->normalize($entity
->getPropertyDefinition('entity'), $format, $context);
}
}