You are here

protected static function FieldResolver::isCandidateDefinitionReferenceProperty in JSON:API 8

Same name and namespace in other branches
  1. 8.2 src/Context/FieldResolver.php \Drupal\jsonapi\Context\FieldResolver::isCandidateDefinitionReferenceProperty()

Determines if a path part targets a reference property.

Parameters

string $part: The path part.

\Drupal\Core\TypedData\ComplexDataDefinitionInterface[] $candidate_definitions: A list of targeted field item definitions which are specified by the path.

Return value

bool TRUE if the part is a property of one of the candidate definitions, FALSE otherwise.

1 call to FieldResolver::isCandidateDefinitionReferenceProperty()
FieldResolver::resolveInternalEntityQueryPath in src/Context/FieldResolver.php
Resolves external field expressions into entity query compatible paths.

File

src/Context/FieldResolver.php, line 614

Class

FieldResolver
A service that evaluates external path expressions against Drupal fields.

Namespace

Drupal\jsonapi\Context

Code

protected static function isCandidateDefinitionReferenceProperty($part, array $candidate_definitions) {
  $part = static::getPathPartPropertyName($part);
  foreach ($candidate_definitions as $definition) {
    $property = $definition
      ->getPropertyDefinition($part);
    if ($property && $property instanceof DataReferenceDefinitionInterface) {
      return TRUE;
    }
  }
  return FALSE;
}