public function ContextAwarePluginTrait::getContext in Drupal 10
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Plugin/ContextAwarePluginTrait.php \Drupal\Core\Plugin\ContextAwarePluginTrait::getContext()
Return value
\Drupal\Core\Plugin\Context\ContextInterface The context object.
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];
}