public function TypedDataManager::getInstance

Implements \Drupal\Component\Plugin\PluginManagerInterface::getInstance().

Parameters

array $options: An array of options with the following keys:

  • object: The parent typed data object, implementing the TypedDataInterface and either the ListInterface or the ComplexDataInterface.
  • property: The name of the property to instantiate, or the delta of the the list item to instantiate.
  • value: The value to set. If set, it has to match one of the supported data type formats as documented by the data type classes.

Return value

\Drupal\Core\TypedData\TypedDataInterface The new property instance.

Throws

\InvalidArgumentException If the given property is not known, or the passed object does not implement the ListInterface or the ComplexDataInterface.

Overrides PluginManagerBase::getInstance

See also

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

File

drupal/core/lib/Drupal/Core/TypedData/TypedDataManager.php, line 175
Contains \Drupal\Core\TypedData\TypedDataManager.

Class

TypedDataManager
Manages data type plugins.

Namespace

Drupal\Core\TypedData

Code

public function getInstance(array $options) {
  return $this
    ->getPropertyInstance($options['object'], $options['property'], $options['value']);
}