function DataDefinitionInterface::createFromDataType
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php \Drupal\Core\TypedData\DataDefinitionInterface::createFromDataType()
- 10 core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php \Drupal\Core\TypedData\DataDefinitionInterface::createFromDataType()
- 11.x core/lib/Drupal/Core/TypedData/DataDefinitionInterface.php \Drupal\Core\TypedData\DataDefinitionInterface::createFromDataType()
Creates a new data definition object.
This method is typically used by \Drupal\Core\TypedData\TypedDataManager::createDataDefinition() to build a definition object for an arbitrary data type. When the definition class is known, it is recommended to directly use the static create() method on that class instead; e.g.:
$map_definition = \Drupal\Core\TypedData\MapDataDefinition::create();
Parameters
string $data_type: The data type, for which a data definition should be created.
Return value
static
Throws
\InvalidArgumentException If an unsupported data type gets passed to the class; e.g., 'string' to a definition class handling 'entity:* data types.
2 methods override DataDefinitionInterface::createFromDataType()
- DataDefinition::createFromDataType in core/
lib/ Drupal/ Core/ TypedData/ DataDefinition.php - Creates a new data definition object.
- FieldConfigBase::createFromDataType in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - Creates a new data definition object.
File
-
core/
lib/ Drupal/ Core/ TypedData/ DataDefinitionInterface.php, line 47
Class
- DataDefinitionInterface
- Interface for data definitions.
Namespace
Drupal\Core\TypedDataCode
public static function createFromDataType($data_type);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.