class ContainerDerivativeDiscoveryDecorator
Same name in other branches
- 9 core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator
- 8.9.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator
- 11.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator
Injects dependencies into derivers if they use ContainerDeriverInterface.
Hierarchy
- class \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator implements \Drupal\Component\Plugin\Discovery\CachedDiscoveryInterface uses \Drupal\Component\Plugin\Discovery\DiscoveryTrait
- class \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator extends \Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator
Expanded class hierarchy of ContainerDerivativeDiscoveryDecorator
See also
\Drupal\Core\Plugin\Discovery\ContainerDeriverInterface
14 files declare their use of ContainerDerivativeDiscoveryDecorator
- BreakpointManager.php in core/
modules/ breakpoint/ src/ BreakpointManager.php - CKEditor5PluginManager.php in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5PluginManager.php - ConfigMapperManager.php in core/
modules/ config_translation/ src/ ConfigMapperManager.php - ContainerDerivativeDiscoveryDecoratorTest.php in core/
tests/ Drupal/ Tests/ Core/ Plugin/ Discovery/ ContainerDerivativeDiscoveryDecoratorTest.php - ContextualLinkManager.php in core/
lib/ Drupal/ Core/ Menu/ ContextualLinkManager.php
File
-
core/
lib/ Drupal/ Core/ Plugin/ Discovery/ ContainerDerivativeDiscoveryDecorator.php, line 12
Namespace
Drupal\Core\Plugin\DiscoveryView source
class ContainerDerivativeDiscoveryDecorator extends DerivativeDiscoveryDecorator {
/**
* {@inheritdoc}
*/
protected function getDeriver($base_plugin_id, $base_definition) {
if (!isset($this->derivers[$base_plugin_id])) {
$this->derivers[$base_plugin_id] = FALSE;
$class = $this->getDeriverClass($base_definition);
if ($class) {
// If the deriver provides a factory method, pass the container to it.
if (is_subclass_of($class, '\\Drupal\\Core\\Plugin\\Discovery\\ContainerDeriverInterface')) {
/** @var \Drupal\Core\Plugin\Discovery\ContainerDeriverInterface $class */
$this->derivers[$base_plugin_id] = $class::create(\Drupal::getContainer(), $base_plugin_id);
}
else {
$this->derivers[$base_plugin_id] = new $class($base_plugin_id);
}
}
}
return $this->derivers[$base_plugin_id] ?: NULL;
}
}
Members
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.