Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
87.50% |
7 / 8 |
| ContainerDerivativeDiscoveryDecorator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
5.05 | |
87.50% |
7 / 8 |
| getDeriver | |
0.00% |
0 / 1 |
5.05 | |
87.50% |
7 / 8 |
|||
| <?php | |
| /** | |
| * @file | |
| * Contains \Drupal\Core\Plugin\Discovery\ContainerDerivativeDiscoveryDecorator. | |
| */ | |
| namespace Drupal\Core\Plugin\Discovery; | |
| use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator; | |
| 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; | |
| } | |
| } |