function DataReferenceDefinition::createFromDataType
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::createFromDataType()
- 10 core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::createFromDataType()
- 11.x core/lib/Drupal/Core/TypedData/DataReferenceDefinition.php \Drupal\Core\TypedData\DataReferenceDefinition::createFromDataType()
Overrides DataDefinition::createFromDataType
File
-
core/
lib/ Drupal/ Core/ TypedData/ DataReferenceDefinition.php, line 37
Class
- DataReferenceDefinition
- A typed data definition class for defining references.
Namespace
Drupal\Core\TypedDataCode
public static function createFromDataType($data_type) {
if (substr($data_type, -strlen('_reference')) != '_reference') {
throw new \InvalidArgumentException('Data type must be of the form "{TARGET_TYPE}_reference"');
}
// Cut of the _reference suffix.
return static::create(substr($data_type, 0, strlen($data_type) - strlen('_reference')));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.