W3cubDocs

/Drupal 8

public function TypedDataManagerInterface::create

public TypedDataManagerInterface::create(DataDefinitionInterface $definition, $value = NULL, $name = NULL, $parent = NULL)

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

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);

© 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::create/8.1.x