You are here

class OverridableDerivativeDiscoveryDecorator in Feeds 8.3

Decorator that prefers non-derived plugins over derived ones.

This way plugins that are generated from a deriver can be overridden with a specific one.

Hierarchy

Expanded class hierarchy of OverridableDerivativeDiscoveryDecorator

1 file declares its use of OverridableDerivativeDiscoveryDecorator
FeedsPluginManager.php in src/Plugin/Type/FeedsPluginManager.php

File

src/Plugin/Discovery/OverridableDerivativeDiscoveryDecorator.php, line 13

Namespace

Drupal\feeds\Plugin\Discovery
View source
class OverridableDerivativeDiscoveryDecorator extends ContainerDerivativeDiscoveryDecorator {

  /**
   * {@inheritdoc}
   */
  public function getDefinitions() {
    $plugin_definitions = $this->decorated
      ->getDefinitions();
    $derivative_plugin_definitions = [];
    foreach ($plugin_definitions as $plugin_id => $plugin_definition) {
      if ($this
        ->getDeriver($plugin_id, $plugin_definition)) {
        $derivative_plugin_definitions[$plugin_id] = $plugin_definition;
        unset($plugin_definitions[$plugin_id]);
      }
    }
    return $plugin_definitions + $this
      ->getDerivatives($derivative_plugin_definitions);
  }

}

Members

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::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
OverridableDerivativeDiscoveryDecorator::getDefinitions public function Gets the definition of all plugins for this type. Overrides DerivativeDiscoveryDecorator::getDefinitions