Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / lib / Drupal / Core / TypedData / ListDataDefinitionInterface.php
1 <?php
2
3 namespace Drupal\Core\TypedData;
4
5 /**
6  * Interface for data definitions of lists.
7  *
8  * This interface is present on a data definition if it describes a list. The
9  * actual lists implement the \Drupal\Core\TypedData\ListInterface.
10  *
11  * @see \Drupal\Core\TypedData\ListDefinition
12  * @see \Drupal\Core\TypedData\ListInterface
13  *
14  * @ingroup typed_data
15  */
16 interface ListDataDefinitionInterface extends DataDefinitionInterface {
17
18   /**
19    * Creates a new list data definition for items of the given data type.
20    *
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.:
26    * @code
27    *   $list_definition = \Drupal\Core\TypedData\ListDataDefinition::create('string');
28    * @endcode
29    *
30    * @param string $item_type
31    *   The item type, for which a list data definition should be created.
32    *
33    * @return static
34    *
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.
38    */
39   public static function createFromItemType($item_type);
40
41   /**
42    * Gets the data definition of an item of the list.
43    *
44    * @return \Drupal\Core\TypedData\DataDefinitionInterface
45    *   A data definition describing the list items.
46    */
47   public function getItemDefinition();
48
49 }