You are here

public function ArrayPluginDefinitionDecorator::setContextDefinition in Plugin 8.2

Sets a specific context definition.

Parameters

string $name: The name of the context in the plugin definition.

\Drupal\Component\Plugin\Context\ContextDefinitionInterface $context_definition: The context definition to set.

Return value

$this

Overrides PluginContextDefinitionInterface::setContextDefinition

File

src/PluginDefinition/ArrayPluginDefinitionDecorator.php, line 240

Class

ArrayPluginDefinitionDecorator
Provides a plugin definition based on an array.

Namespace

Drupal\plugin\PluginDefinition

Code

public function setContextDefinition($name, ContextDefinitionInterface $context_definition) {
  $this->arrayDefinition['context'][$name] = $context_definition;
  return $this;
}