function TypedDataManagerInterface::create

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

Creates a new typed data object instance.

Parameters

\Drupal\Core\TypedData\DataDefinitionInterface $definition: The data definition of the typed data object. For backwards-compatibility an array representation of the data definition may be passed also.

mixed $value: (optional) The data value. If set, it has to match one of the supported data type format as documented for the data type classes.

string $name: (optional) If a property or list item is to be created, the name of the property or the delta of the list item.

mixed $parent: (optional) If a property or list item is to be created, the parent typed data object implementing either the ListInterface or the ComplexDataInterface.

Return value

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

See also

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

\Drupal\Core\TypedData\Plugin\DataType\BinaryData

\Drupal\Core\TypedData\Plugin\DataType\BooleanData

\Drupal\Core\TypedData\Plugin\DataType\Date

\Drupal\Core\TypedData\Plugin\DataType\Duration

\Drupal\Core\TypedData\Plugin\DataType\FloatData

\Drupal\Core\TypedData\Plugin\DataType\IntegerData

\Drupal\Core\TypedData\Plugin\DataType\StringData

\Drupal\Core\TypedData\Plugin\DataType\Uri

1 method overrides TypedDataManagerInterface::create()
TypedDataManager::create in core/lib/Drupal/Core/TypedData/TypedDataManager.php
Creates a new typed data object instance.

File

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

Class

TypedDataManagerInterface
Defines an interface for typed data manager.

Namespace

Drupal\Core\TypedData

Code

public function create(DataDefinitionInterface $definition, $value = NULL, $name = NULL, $parent = NULL);

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