Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 4 |
| ContextAwarePluginManagerTrait | |
0.00% |
0 / 1 |
|
33.33% |
1 / 3 |
12 | |
0.00% |
0 / 4 |
| contextHandler | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getDefinitionsForContexts | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| getDefinitions | |
100.00% |
1 / 1 |
1 | |
100.00% |
0 / 0 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\Plugin\Context\ContextAwarePluginManagerTrait. | |
| */ | |
| namespace Drupal\Core\Plugin\Context; | |
| /** | |
| * Provides a trait for plugin managers that support context-aware plugins. | |
| */ | |
| 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(). | |
| */ | |
| abstract public function getDefinitions(); | |
| } |