class ContextAwarePluginBase
Same name in other branches
- 8.9.x core/lib/Drupal/Core/Plugin/ContextAwarePluginBase.php \Drupal\Core\Plugin\ContextAwarePluginBase
- 8.9.x core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php \Drupal\Component\Plugin\ContextAwarePluginBase
Base class for plugins that are context aware.
Hierarchy
- class \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\PluginInspectionInterface, \Drupal\Component\Plugin\DerivativeInspectionInterface
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
- class \Drupal\Core\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\ContextAwarePluginBase implements \Drupal\Core\Plugin\ContextAwarePluginInterface, \Drupal\Core\Cache\CacheableDependencyInterface uses \Drupal\Core\Plugin\ContextAwarePluginTrait, \Drupal\Core\TypedData\TypedDataTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\DependencyInjection\DependencySerializationTrait
- class \Drupal\Component\Plugin\ContextAwarePluginBase extends \Drupal\Component\Plugin\PluginBase implements \Drupal\Component\Plugin\ContextAwarePluginInterface
Expanded class hierarchy of ContextAwarePluginBase
Deprecated
in drupal:9.1.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Plugin\ContextAwarePluginTrait instead.
See also
https://www.drupal.org/node/3120980
1 file declares its use of ContextAwarePluginBase
- ContextAwarePluginBaseTest.php in core/
tests/ Drupal/ KernelTests/ Core/ Plugin/ Context/ ContextAwarePluginBaseTest.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ ContextAwarePluginBase.php, line 22
Namespace
Drupal\Core\PluginView source
abstract class ContextAwarePluginBase extends ComponentContextAwarePluginBase implements ContextAwarePluginInterface, CacheableDependencyInterface {
use ContextAwarePluginTrait;
use TypedDataTrait;
use StringTranslationTrait;
use DependencySerializationTrait;
/**
* {@inheritdoc}
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
*/
protected function createContextFromConfiguration(array $context_configuration) {
// This method is overridden so that it will use
// \Drupal\Core\Plugin\Context\Context instead.
$contexts = [];
foreach ($context_configuration as $key => $value) {
$context_definition = $this->getContextDefinition($key);
$contexts[$key] = new Context($context_definition, $value);
}
return $contexts;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.