W3cubDocs

/Drupal 8

public function TypedDataManagerInterface::createInstance

public TypedDataManagerInterface::createInstance($data_type, array $configuration = array())

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 = array());

© 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!TypedData!TypedDataManagerInterface.php/function/TypedDataManagerInterface::createInstance/8.1.x