You are here

public function ArrayPluginDefinitionDecorator::setContextDefinitions in Plugin 8.2

Sets the context definitions.

Parameters

\Drupal\Component\Plugin\Context\ContextDefinitionInterface[] $context_definitions: The array of context definitions, keyed by context name.

Return value

$this

Throws

\InvalidArgumentException Thrown if the definitions are invalid.

Overrides PluginContextDefinitionInterface::setContextDefinitions

1 call to ArrayPluginDefinitionDecorator::setContextDefinitions()
ArrayPluginDefinitionDecorator::offsetSet in src/PluginDefinition/ArrayPluginDefinitionDecorator.php

File

src/PluginDefinition/ArrayPluginDefinitionDecorator.php, line 222

Class

ArrayPluginDefinitionDecorator
Provides a plugin definition based on an array.

Namespace

Drupal\plugin\PluginDefinition

Code

public function setContextDefinitions(array $context_definitions) {
  PluginDefinitionValidator::validateContextDefinitions($context_definitions);
  $this->arrayDefinition['context'] = $context_definitions;
  return $this;
}