function BaseFieldDefinition::createFromItemType

Same name in other branches
  1. 9 core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::createFromItemType()
  2. 8.9.x core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::createFromItemType()
  3. 11.x core/lib/Drupal/Core/Field/BaseFieldDefinition.php \Drupal\Core\Field\BaseFieldDefinition::createFromItemType()

Overrides ListDataDefinition::createFromItemType

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

File

core/lib/Drupal/Core/Field/BaseFieldDefinition.php, line 101

Class

BaseFieldDefinition
A class for defining entity fields.

Namespace

Drupal\Core\Field

Code

public static function createFromItemType($item_type) {
    // The data type of a field item is in the form of "field_item:$field_type".
    $parts = explode(':', $item_type, 2);
    return static::create($parts[1]);
}

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