function FieldConfigBase::createFromDataType

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

Creates a new data definition object.

This method is typically used by \Drupal\Core\TypedData\TypedDataManager::createDataDefinition() to build a definition object for an arbitrary data type. When the definition class is known, it is recommended to directly use the static create() method on that class instead; e.g.:

$map_definition = \Drupal\Core\TypedData\MapDataDefinition::create();

Parameters

string $data_type: The data type, for which a data definition should be created.

Return value

static

Overrides DataDefinitionInterface::createFromDataType

File

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

Class

FieldConfigBase
Base class for configurable field definitions.

Namespace

Drupal\Core\Field

Code

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

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