You are here

protected function ComplexDataDefinitionNormalizer::isReferenceField in Schemata 8

Same name in this branch
  1. 8 schemata_json_schema/src/Normalizer/jsonapi/ComplexDataDefinitionNormalizer.php \Drupal\schemata_json_schema\Normalizer\jsonapi\ComplexDataDefinitionNormalizer::isReferenceField()
  2. 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.

1 call to ComplexDataDefinitionNormalizer::isReferenceField()
ComplexDataDefinitionNormalizer::normalize in schemata_json_schema/src/Normalizer/hal/ComplexDataDefinitionNormalizer.php
Normalizes an object into a set of arrays/scalars.

File

schemata_json_schema/src/Normalizer/json/ComplexDataDefinitionNormalizer.php, line 57

Class

ComplexDataDefinitionNormalizer
Normalizer for ComplexDataDefinitionInterface.

Namespace

Drupal\schemata_json_schema\Normalizer\json

Code

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;
}