function ContextAwarePluginTrait::setContext
3 calls to ContextAwarePluginTrait::setContext()
- ContextAwarePluginTrait::setContextValue in core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php - DefaultsSectionStorage::setContext in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php - DefaultsSectionStorage::setContext in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php
1 method overrides ContextAwarePluginTrait::setContext()
- DefaultsSectionStorage::setContext in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginTrait.php, line 59
Class
- ContextAwarePluginTrait
- Provides a trait to add context-aware functionality to plugins.
Namespace
Drupal\Core\PluginCode
public function setContext($name, ComponentContextInterface $context) {
// Check that the context passed is an instance of our extended interface.
if (!$context instanceof ContextInterface) {
throw new ContextException("Passed {$name} context must be an instance of \\Drupal\\Core\\Plugin\\Context\\ContextInterface");
}
$this->context[$name] = $context;
}