Override of \Drupal\Component\Plugin\ContextAwarePluginBase::setContextValue().
Overrides ContextAwarePluginBase::setContextValue
public function setContextValue($name, $value) {
$context_definition = $this
->getContextDefinition($name);
// Use the Drupal specific context class.
$this->context[$name] = new Context($context_definition);
$this->context[$name]
->setContextValue($value);
// Verify the provided value validates.
if ($this->context[$name]
->validate()
->count() > 0) {
throw new PluginException("The provided context value does not pass validation.");
}
return $this;
}