function TypedDataManagerInterface::createDataDefinition
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createDataDefinition()
- 8.9.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createDataDefinition()
- 11.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createDataDefinition()
Creates a new data definition object.
While data definitions objects may be created directly if the definition class used by a data type is known, this method allows the creation of data definitions for any given data type.
For example, if a definition for a map is to be created, the following code could be used instead of calling this method with the argument 'map':
$map_definition = \Drupal\Core\TypedData\MapDataDefinition::create();
Parameters
string $data_type: The data type plugin ID, for which a data definition object should be created.
Return value
\Drupal\Core\TypedData\DataDefinitionInterface A data definition object for the given data type. The class of this object is provided by the definition_class in the plugin annotation.
See also
\Drupal\Core\TypedData\TypedDataManager::createListDataDefinition()
File
-
core/
lib/ Drupal/ Core/ TypedData/ TypedDataManagerInterface.php, line 94
Class
- TypedDataManagerInterface
- Defines an interface for typed data manager.
Namespace
Drupal\Core\TypedDataCode
public function createDataDefinition($data_type);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.