function ListDataDefinition::createFromItemType

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::createFromItemType()
  2. 10 core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::createFromItemType()
  3. 11.x core/lib/Drupal/Core/TypedData/ListDataDefinition.php \Drupal\Core\TypedData\ListDataDefinition::createFromItemType()

Overrides ListDataDefinitionInterface::createFromItemType

1 call to ListDataDefinition::createFromItemType()
ListDataDefinition::create in core/lib/Drupal/Core/TypedData/ListDataDefinition.php
Creates a new list definition.
1 method overrides ListDataDefinition::createFromItemType()
BaseFieldDefinition::createFromItemType in core/lib/Drupal/Core/Field/BaseFieldDefinition.php
Creates a new list data definition for items of the given data type.

File

core/lib/Drupal/Core/TypedData/ListDataDefinition.php, line 43

Class

ListDataDefinition
A typed data definition class for defining lists.

Namespace

Drupal\Core\TypedData

Code

public static function createFromItemType($item_type) {
    return new static([], \Drupal::typedDataManager()->createDataDefinition($item_type));
}

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