function TypedDataInterface::createInstance

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

Constructs a TypedData object given its definition and context.

@todo When \Drupal\Core\Config\TypedConfigManager has been fixed to use class-based definitions, type-hint $definition to DataDefinitionInterface. https://www.drupal.org/node/1928868

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $definition: The data definition.

string|null $name: (optional) The name of the created property, or NULL if it is the root of a typed data tree. Defaults to NULL.

\Drupal\Core\TypedData\TraversableTypedDataInterface $parent: (optional) The parent object of the data property, or NULL if it is the root of a typed data tree. Defaults to NULL.

See also

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

1 method overrides TypedDataInterface::createInstance()
TypedData::createInstance in core/lib/Drupal/Core/TypedData/TypedData.php
Constructs a TypedData object given its definition and context.

File

core/lib/Drupal/Core/TypedData/TypedDataInterface.php, line 32

Class

TypedDataInterface
Interface for typed data objects.

Namespace

Drupal\Core\TypedData

Code

public static function createInstance($definition, $name = NULL, ?TraversableTypedDataInterface $parent = NULL);

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