function ContextAwarePluginBase::__construct
Same name in other branches
- 9 core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase::__construct()
Overrides \Drupal\Component\Plugin\PluginBase::__construct().
Overrides the construction of context aware plugins to allow for unvalidated constructor based injection of contexts.
Parameters
array $configuration: The plugin configuration, i.e. an array with configuration values keyed by configuration option name. The special key 'context' may be used to initialize the defined contexts by setting it to an array of context values keyed by context names.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
Overrides PluginBase::__construct
4 calls to ContextAwarePluginBase::__construct()
- ConditionPluginBase::__construct in core/
lib/ Drupal/ Core/ Condition/ ConditionPluginBase.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- DefaultsSectionStorage::__construct in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- OverridesSectionStorage::__construct in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ OverridesSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- SimpleConfigSectionStorage::__construct in core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ SectionStorage/ SimpleConfigSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
4 methods override ContextAwarePluginBase::__construct()
- ConditionPluginBase::__construct in core/
lib/ Drupal/ Core/ Condition/ ConditionPluginBase.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- DefaultsSectionStorage::__construct in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ DefaultsSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- OverridesSectionStorage::__construct in core/
modules/ layout_builder/ src/ Plugin/ SectionStorage/ OverridesSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
- SimpleConfigSectionStorage::__construct in core/
modules/ layout_builder/ tests/ modules/ layout_builder_test/ src/ Plugin/ SectionStorage/ SimpleConfigSectionStorage.php - Overrides \Drupal\Component\Plugin\PluginBase::__construct().
File
-
core/
lib/ Drupal/ Component/ Plugin/ ContextAwarePluginBase.php, line 52
Class
- ContextAwarePluginBase
- Base class for plugins that are context aware.
Namespace
Drupal\Component\PluginCode
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
$context_configuration = isset($configuration['context']) ? $configuration['context'] : [];
unset($configuration['context']);
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->context = $this->createContextFromConfiguration($context_configuration);
// @todo Remove $this->contexts in Drupal 9; see
// https://www.drupal.org/project/drupal/issues/3081145
$this->contexts = $this->context;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.