protected static function ResourceTestBase::isReferenceFieldDefinition in Drupal 8
Same name and namespace in other branches
- 9 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::isReferenceFieldDefinition()
- 10 core/modules/jsonapi/tests/src/Functional/ResourceTestBase.php \Drupal\Tests\jsonapi\Functional\ResourceTestBase::isReferenceFieldDefinition()
Determines if a given field definition is a reference field.
Parameters
\Drupal\Core\Field\FieldDefinitionInterface $field_definition: The field definition to inspect.
Return value
bool TRUE if the field definition is found to be a reference field. FALSE otherwise.
1 call to ResourceTestBase::isReferenceFieldDefinition()
- ResourceTestBase::getRelationshipFieldNames in core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php - Gets a list of public relationship names for the resource type under test.
File
- core/
modules/ jsonapi/ tests/ src/ Functional/ ResourceTestBase.php, line 3377
Class
- ResourceTestBase
- Subclass this for every JSON:API resource type.
Namespace
Drupal\Tests\jsonapi\FunctionalCode
protected static function isReferenceFieldDefinition(FieldDefinitionInterface $field_definition) {
/* @var \Drupal\Core\Field\TypedData\FieldItemDataDefinition $item_definition */
$item_definition = $field_definition
->getItemDefinition();
$main_property = $item_definition
->getMainPropertyName();
$property_definition = $item_definition
->getPropertyDefinition($main_property);
return $property_definition instanceof DataReferenceTargetDefinition;
}