Created
February 16, 2013 18:26
-
-
Save fago/4968056 to your computer and use it in GitHub Desktop.
$plugin->setContextValue()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements \Drupal\Component\Plugin\ContextAwarePluginInterface::setContextValue(). | |
*/ | |
public function setContextValue($key, $value) { | |
$context_definition = $this->getContextDefinition($key); | |
$this->context[$key] = new Context($context_definition); | |
$this->context[$key]->setValue($value); | |
if ($this->context[$key]->validate($value)->count() > 0) { | |
throw new PluginException("The provided value for $key is not valid."); | |
} | |
return $this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment