protected function ComplexDataDefinitionNormalizer::isReferenceField in Schemata 8
Same name in this branch
- 8 schemata_json_schema/src/Normalizer/jsonapi/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\jsonapi\ComplexDataDefinitionNormalizer::isReferenceField()
- 8 schemata_json_schema/src/Normalizer/json/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\json\ComplexDataDefinitionNormalizer::isReferenceField()
Determine if the current field is a reference field.
Parameters
\Drupal\Core\TypedData\ComplexDataDefinitionInterface $entity: The complex data definition to be checked.
array $context: The current serializer context.
Return value
bool TRUE if it is a reference, FALSE otherwise.
File
- schemata_json_schema/
src/ Normalizer/ jsonapi/ ComplexDataDefinitionNormalizer.php, line 62
Class
- ComplexDataDefinitionNormalizer
- Normalizer for ComplexDataDefinitionInterface.
Namespace
Drupal\schemata_json_schema\Normalizer\jsonapiCode
protected function isReferenceField(ComplexDataDefinitionInterface $entity, array $context = NULL) {
$main = $entity
->getPropertyDefinition($entity
->getMainPropertyName());
// @todo use an interface or API call instead of an object check.
return $main instanceof DataReferenceTargetDefinition;
}