function TypedDataManagerInterface::createInstance

Same name in other branches
  1. 9 core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createInstance()
  2. 8.9.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createInstance()
  3. 11.x core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createInstance()

Instantiates a typed data object.

Parameters

string $data_type: The data type, for which a typed object should be instantiated.

array $configuration: The plugin configuration array, i.e. an array with the following keys:

  • data_definition: The data definition object, i.e. an instance of \Drupal\Core\TypedData\DataDefinitionInterface.
  • name: The name of the property or the delta of the list item if a property or list item is to be created. Otherwise, this should be set to NULL, but the key must be specified.
  • parent: The parent typed data object implementing either the ListInterface or the ComplexDataInterface if a property or list item is to be created. Otherwise, this should be set to NULL, but the key must be specified.

Return value

\Drupal\Core\TypedData\TypedDataInterface The instantiated typed data object.

See also

\Drupal\Core\TypedData\TypedDataManager::create()

File

core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php, line 37

Class

TypedDataManagerInterface
Defines an interface for typed data manager.

Namespace

Drupal\Core\TypedData

Code

public function createInstance($data_type, array $configuration = []);

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