function ContextAwarePluginTrait::getContext
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContext()
- 11.x core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContext()
Return value
\Drupal\Core\Plugin\Context\ContextInterface The context object.
2 calls to ContextAwarePluginTrait::getContext()
- ContextAwarePluginTrait::getContexts in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php - ContextAwarePluginTrait::setContextValue in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php, line 48
Class
- ContextAwarePluginTrait
- Provides a trait to add context-aware functionality to plugins.
Namespace
Drupal\Core\PluginCode
public function getContext($name) {
// Check for a valid context value.
if (!isset($this->context[$name])) {
$this->context[$name] = new Context($this->getContextDefinition($name));
}
return $this->context[$name];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.