function ListDataDefinitionInterface::createFromItemType
Same name in other branches
- 9 core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface::createFromItemType()
- 8.9.x core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface::createFromItemType()
- 11.x core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface::createFromItemType()
Creates a new list data definition for items of the given data type.
This method is typically used by \Drupal\Core\TypedData\TypedDataManager::createListDataDefinition() to build a definition object for an arbitrary item type. When the definition class is known, it is recommended to directly use the static create() method on that class instead; e.g.:
$list_definition = \Drupal\Core\TypedData\ListDataDefinition::create('string');
Parameters
string $item_type: The item type, for which a list 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 lists of 'field_item:* data types.
2 methods override ListDataDefinitionInterface::createFromItemType()
- FieldConfigBase::createFromItemType in core/
lib/ Drupal/ Core/ Field/ FieldConfigBase.php - ListDataDefinition::createFromItemType in core/
lib/ Drupal/ Core/ TypedData/ ListDataDefinition.php
File
-
core/
lib/ Drupal/ Core/ TypedData/ ListDataDefinitionInterface.php, line 39
Class
- ListDataDefinitionInterface
- Interface for data definitions of lists.
Namespace
Drupal\Core\TypedDataCode
public static function createFromItemType($item_type);
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.