ContainerDerivativeDiscoveryDecorator.php in Plug 7
File
lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php
View source
<?php
namespace Drupal\Core\Plugin\Discovery;
use Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator;
class ContainerDerivativeDiscoveryDecorator extends DerivativeDiscoveryDecorator {
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 (is_subclass_of($class, '\\Drupal\\Core\\Plugin\\Discovery\\ContainerDeriverInterface')) {
$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;
}
}