trait ContextAwarePluginManagerTrait in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Plugin/Context/ContextAwarePluginManagerTrait.php \Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait
Provides a trait for plugin managers that support context-aware plugins.
Hierarchy
- trait \Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait
2 files declare their use of ContextAwarePluginManagerTrait
- BlockManager.php in core/
lib/ Drupal/ Core/ Block/ BlockManager.php - Contains \Drupal\Core\Block\BlockManager.
- ConditionManager.php in core/
lib/ Drupal/ Core/ Condition/ ConditionManager.php - Contains \Drupal\Core\Condition\ConditionManager.
File
- core/
lib/ Drupal/ Core/ Plugin/ Context/ ContextAwarePluginManagerTrait.php, line 13 - Contains \Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait.
Namespace
Drupal\Core\Plugin\ContextView source
trait ContextAwarePluginManagerTrait {
/**
* Wraps the context handler.
*
* @return \Drupal\Core\Plugin\Context\ContextHandlerInterface
*/
protected function contextHandler() {
return \Drupal::service('context.handler');
}
/**
* See \Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface::getDefinitionsForContexts().
*/
public function getDefinitionsForContexts(array $contexts = array()) {
return $this
->contextHandler()
->filterPluginDefinitionsByContexts($contexts, $this
->getDefinitions());
}
/**
* See \Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions().
*/
public abstract function getDefinitions();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ContextAwarePluginManagerTrait:: |
protected | function | Wraps the context handler. | |
ContextAwarePluginManagerTrait:: |
abstract public | function | See \Drupal\Component\Plugin\Discovery\DiscoveryInterface::getDefinitions(). | |
ContextAwarePluginManagerTrait:: |
public | function | See \Drupal\Core\Plugin\Context\ContextAwarePluginManagerInterface::getDefinitionsForContexts(). |