function NoSourcePluginDecorator::getDefinitions

Same name in other branches
  1. 9 core/modules/migrate/src/Plugin/NoSourcePluginDecorator.php \Drupal\migrate\Plugin\NoSourcePluginDecorator::getDefinitions()
  2. 10 core/modules/migrate/src/Plugin/NoSourcePluginDecorator.php \Drupal\migrate\Plugin\NoSourcePluginDecorator::getDefinitions()
  3. 11.x core/modules/migrate/src/Plugin/NoSourcePluginDecorator.php \Drupal\migrate\Plugin\NoSourcePluginDecorator::getDefinitions()

Overrides DiscoveryTrait::getDefinitions

File

core/modules/migrate/src/Plugin/NoSourcePluginDecorator.php, line 35

Class

NoSourcePluginDecorator
Remove definitions which refer to a non-existing source plugin.

Namespace

Drupal\migrate\Plugin

Code

public function getDefinitions() {
    
    /** @var \Drupal\Component\Plugin\PluginManagerInterface $source_plugin_manager */
    $source_plugin_manager = \Drupal::service('plugin.manager.migrate.source');
    return array_filter($this->decorated
        ->getDefinitions(), function (array $definition) use ($source_plugin_manager) {
        return $source_plugin_manager->hasDefinition($definition['source']['plugin']);
    });
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.