You are here

public function NoSourcePluginDecorator::getDefinitions in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/NoSourcePluginDecorator.php \Drupal\migrate\Plugin\NoSourcePluginDecorator::getDefinitions()

Gets the definition of all plugins for this type.

Return value

mixed[] An array of plugin definitions (empty array if no definitions were found). Keys are plugin IDs.

Overrides DiscoveryTrait::getDefinitions

See also

\Drupal\Core\Plugin\FilteredPluginManagerInterface::getFilteredDefinitions()

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