You are here

public function TypedDataManagerInterface::createInstance in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/TypedData/TypedDataManagerInterface.php \Drupal\Core\TypedData\TypedDataManagerInterface::createInstance()
  2. 9 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.

Overrides FactoryInterface::createInstance

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 = []);