function DataReferenceDefinition::create
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::create()
- 10 core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::create()
- 11.x core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::create()
Creates a new data reference definition.
Parameters
string $target_data_type: The data type of the referenced data.
Return value
static
Overrides DataDefinition::create
3 calls to DataReferenceDefinition::create()
- DataReferenceDefinition::createFromDataType in core/
lib/ Drupal/ Core/ TypedData/ DataReferenceDefinition.php - Creates a new data definition object.
- EntityTypedDataDefinitionTest::testEntityReferences in core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityTypedDataDefinitionTest.php - Tests deriving metadata from entity references.
- TypedDataDefinitionTest::testDataReferences in core/
tests/ Drupal/ KernelTests/ Core/ TypedData/ TypedDataDefinitionTest.php - Tests deriving metadata from data references.
File
-
core/
lib/ Drupal/ Core/ TypedData/ DataReferenceDefinition.php, line 28
Class
- DataReferenceDefinition
- A typed data definition class for defining references.
Namespace
Drupal\Core\TypedDataCode
public static function create($target_data_type) {
// This assumes implementations use a "TYPE_reference" naming pattern.
$definition = parent::create($target_data_type . '_reference');
return $definition->setTargetDefinition(\Drupal::typedDataManager()->createDataDefinition($target_data_type));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.