public static function FieldConfigBase::createFromItemType

public static FieldConfigBase::createFromItemType($item_type)

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.

Overrides ListDataDefinitionInterface::createFromItemType

File

core/lib/Drupal/Core/Field/FieldConfigBase.php, line 457

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

public static function createFromItemType($item_type) {
  // Forward to the field definition class for creating new data definitions
  // via the typed manager.
  return BaseFieldDefinition::createFromItemType($item_type);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Field!FieldConfigBase.php/function/FieldConfigBase::createFromItemType/8.1.x