You are here

public function OverridableDerivativeDiscoveryDecorator::getDefinitions in Feeds 8.3

Throws

\Drupal\Component\Plugin\Exception\InvalidDeriverException Thrown if the 'deriver' class specified in the plugin definition does not implement \Drupal\Component\Plugin\Derivative\DeriverInterface.

Overrides DerivativeDiscoveryDecorator::getDefinitions

File

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

Class

OverridableDerivativeDiscoveryDecorator
Decorator that prefers non-derived plugins over derived ones.

Namespace

Drupal\feeds\Plugin\Discovery

Code

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);
}