8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.5.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.0.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.1.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.2.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.3.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.4.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.6.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)
8.6.x ContextAwarePluginBase.php ContextAwarePluginBase::setContextValue($name, $value)

Sets the value for a defined context.

Parameters

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

mixed $value: The value to set the context to. The value has to validate against the provided context definition.

Return value

\Drupal\Component\Plugin\ContextAwarePluginInterface A context aware plugin object for chaining.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the value does not pass validation.

Overrides ContextAwarePluginBase::setContextValue

File

core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php, line 72

Class

ContextAwarePluginBase
Base class for plugins that are context aware.

Namespace

Drupal\Core\Plugin

Code

public function setContextValue($name, $value) {
  $this->context[$name] = Context::createFromContext($this
    ->getContext($name), $value);
  return $this;
}