1. 8.5.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  2. 8.0.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  3. 8.1.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  4. 8.2.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  5. 8.3.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  6. 8.4.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator
  7. 8.6.x core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php ContainerDerivativeDiscoveryDecorator

Hierarchy

Expanded class hierarchy of ContainerDerivativeDiscoveryDecorator

11 files declare their use of ContainerDerivativeDiscoveryDecorator

File

core/lib/Drupal/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecorator.php, line 7

Namespace

Drupal\Core\Plugin\Discovery
View 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

Contains filters are case sensitive
Namesort descending Modifiers Type Description Overrides
ContainerDerivativeDiscoveryDecorator::getDeriver protected function Gets a deriver for a base plugin. Overrides DerivativeDiscoveryDecorator::getDeriver
DerivativeDiscoveryDecorator::$decorated protected property The decorated plugin discovery.
DerivativeDiscoveryDecorator::$derivers protected property Plugin derivers.
DerivativeDiscoveryDecorator::decodePluginId protected function Decodes derivative id and plugin id from a string.
DerivativeDiscoveryDecorator::encodePluginId protected function Encodes plugin and derivative id's into a string.
DerivativeDiscoveryDecorator::getDefinition public function Overrides DiscoveryTrait::getDefinition
DerivativeDiscoveryDecorator::getDefinitions public function Overrides DiscoveryTrait::getDefinitions
DerivativeDiscoveryDecorator::getDerivatives protected function Adds derivatives to a list of plugin definitions.
DerivativeDiscoveryDecorator::getDeriverClass protected function Gets the deriver class name from the base plugin definition.
DerivativeDiscoveryDecorator::mergeDerivativeDefinition protected function Merges a base and derivative definition, taking into account empty values.
DerivativeDiscoveryDecorator::__call public function Passes through all unknown calls onto the decorated object.
DerivativeDiscoveryDecorator::__construct public function Creates a new instance.
DiscoveryTrait::doGetDefinition protected function Gets a specific plugin definition.
DiscoveryTrait::hasDefinition public function Indicates if a specific plugin definition exists. Overrides DiscoveryInterface::hasDefinition