You are here

public static function ArrayPluginDefinitionDecorator::createFromDecoratedDefinition in Plugin 8.2

Creates a new plugin definition that decorates another definition.

Parameters

mixed $decorated_plugin_definition: The plugin definition to decorate. The supported types depend on the implementations of this method.

Return value

static

Overrides PluginDefinitionDecoratorInterface::createFromDecoratedDefinition

2 calls to ArrayPluginDefinitionDecorator::createFromDecoratedDefinition()
ArrayPluginDefinitionDecoratorTest::testCreateFromDecoratedDefinition in tests/src/Unit/PluginDefinition/ArrayPluginDefinitionDecoratorTest.php
@covers ::createFromDecoratedDefinition
ArrayPluginDefinitionDecoratorTest::testCreateFromDecoratedDefinitionWithInvalidDecoratedDefinition in tests/src/Unit/PluginDefinition/ArrayPluginDefinitionDecoratorTest.php
@covers ::createFromDecoratedDefinition

File

src/PluginDefinition/ArrayPluginDefinitionDecorator.php, line 46

Class

ArrayPluginDefinitionDecorator
Provides a plugin definition based on an array.

Namespace

Drupal\plugin\PluginDefinition

Code

public static function createFromDecoratedDefinition($decorated_plugin_definition) {
  if (!is_array($decorated_plugin_definition)) {
    $type = is_object($decorated_plugin_definition) ? get_class($decorated_plugin_definition) : gettype($decorated_plugin_definition);
    throw new \InvalidArgumentException(sprintf('The decorated plugin definition must be an array, but %s given.', $type));
  }
  return new static($decorated_plugin_definition);
}