interface ListDataDefinitionInterface

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface
  2. 10 core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface
  3. 11.x core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php \Drupal\Core\TypedData\ListDataDefinitionInterface

Interface for data definitions of lists.

This interface is present on a data definition if it describes a list. The actual lists implement the \Drupal\Core\TypedData\ListInterface.

Hierarchy

Expanded class hierarchy of ListDataDefinitionInterface

All classes that implement ListDataDefinitionInterface

See also

\Drupal\Core\TypedData\ListDefinition

\Drupal\Core\TypedData\ListInterface

Related topics

3 files declare their use of ListDataDefinitionInterface
EntityTypedDataDefinitionTest.php in core/tests/Drupal/KernelTests/Core/Entity/EntityTypedDataDefinitionTest.php
FieldDefinitionInterface.php in core/lib/Drupal/Core/Field/FieldDefinitionInterface.php
TypedDataDefinitionTest.php in core/tests/Drupal/KernelTests/Core/TypedData/TypedDataDefinitionTest.php

File

core/lib/Drupal/Core/TypedData/ListDataDefinitionInterface.php, line 16

Namespace

Drupal\Core\TypedData
View source
interface ListDataDefinitionInterface extends DataDefinitionInterface {
    
    /**
     * 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.:
     * @code
     *   $list_definition = \Drupal\Core\TypedData\ListDataDefinition::create('string');
     * @endcode
     *
     * @param string $item_type
     *   The item type, for which a list data definition should be created.
     *
     * @return 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.
     */
    public static function createFromItemType($item_type);
    
    /**
     * Gets the data definition of an item of the list.
     *
     * @return \Drupal\Core\TypedData\DataDefinitionInterface
     *   A data definition describing the list items.
     */
    public function getItemDefinition();

}

Members

Title Sort descending Modifiers Object type Summary Overrides
DataDefinitionInterface::addConstraint public function Adds a validation constraint. 2
DataDefinitionInterface::createFromDataType public static function Creates a new data definition object. 2
DataDefinitionInterface::getClass public function Returns the class used for creating the typed data object. 2
DataDefinitionInterface::getConstraint public function Returns a validation constraint. 2
DataDefinitionInterface::getConstraints public function Returns an array of validation constraints. 2
DataDefinitionInterface::getDataType public function Returns the data type of the data. 2
DataDefinitionInterface::getDescription public function Returns a human readable description. 2
DataDefinitionInterface::getLabel public function Returns a human readable label. 2
DataDefinitionInterface::getSetting public function Returns the value of a given setting. 2
DataDefinitionInterface::getSettings public function Returns the array of settings, as required by the used class. 2
DataDefinitionInterface::isComputed public function Determines whether the data value is computed. 3
DataDefinitionInterface::isInternal public function Determines whether the data value is internal. 2
DataDefinitionInterface::isList public function Returns whether the data is multi-valued, i.e. a list of data items. 2
DataDefinitionInterface::isReadOnly public function Determines whether the data is read-only. 3
DataDefinitionInterface::isRequired public function Determines whether a data value is required. 2
ListDataDefinitionInterface::createFromItemType public static function Creates a new list data definition for items of the given data type. 2
ListDataDefinitionInterface::getItemDefinition public function Gets the data definition of an item of the list. 2

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.