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