3 namespace Drupal\Core\TypedData;
6 * Interface for data definitions of lists.
8 * This interface is present on a data definition if it describes a list. The
9 * actual lists implement the \Drupal\Core\TypedData\ListInterface.
11 * @see \Drupal\Core\TypedData\ListDefinition
12 * @see \Drupal\Core\TypedData\ListInterface
16 interface ListDataDefinitionInterface extends DataDefinitionInterface {
19 * Creates a new list data definition for items of the given data type.
21 * This method is typically used by
22 * \Drupal\Core\TypedData\TypedDataManager::createListDataDefinition() to
23 * build a definition object for an arbitrary item type. When the definition
24 * class is known, it is recommended to directly use the static create()
25 * method on that class instead; e.g.:
27 * $list_definition = \Drupal\Core\TypedData\ListDataDefinition::create('string');
30 * @param string $item_type
31 * The item type, for which a list data definition should be created.
35 * @throws \InvalidArgumentException
36 * If an unsupported data type gets passed to the class; e.g., 'string' to a
37 * definition class handling lists of 'field_item:* data types.
39 public static function createFromItemType($item_type);
42 * Gets the data definition of an item of the list.
44 * @return \Drupal\Core\TypedData\DataDefinitionInterface
45 * A data definition describing the list items.
47 public function getItemDefinition();