Same name and namespace in other branches
  1. 8.9.x core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php \Drupal\migrate\Plugin\MigrateSourcePluginManager
  2. 9 core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php \Drupal\migrate\Plugin\MigrateSourcePluginManager

Plugin manager for migrate source plugins.

Hierarchy

Expanded class hierarchy of MigrateSourcePluginManager

See also

\Drupal\migrate\Plugin\MigrateSourceInterface

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase

\Drupal\migrate\Annotation\MigrateSource

Plugin API

Related topics

2 files declare their use of MigrateSourcePluginManager
MigrationPluginManager.php in core/modules/migrate_drupal/src/MigrationPluginManager.php
MigrationTest.php in core/modules/migrate/tests/src/Unit/MigrationTest.php
1 string reference to 'MigrateSourcePluginManager'
migrate.services.yml in core/modules/migrate/migrate.services.yml
core/modules/migrate/migrate.services.yml
1 service uses MigrateSourcePluginManager
plugin.manager.migrate.source in core/modules/migrate/migrate.services.yml
Drupal\migrate\Plugin\MigrateSourcePluginManager

File

core/modules/migrate/src/Plugin/MigrateSourcePluginManager.php, line 21

Namespace

Drupal\migrate\Plugin
View source
class MigrateSourcePluginManager extends MigratePluginManager {

  /**
   * MigrateSourcePluginManager constructor.
   *
   * @param string $type
   *   The type of the plugin: row, source, process, destination, entity_field,
   *   id_map.
   * @param \Traversable $namespaces
   *   An object that implements \Traversable which contains the root paths
   *   keyed by the corresponding namespace to look for plugin implementations.
   * @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
   *   Cache backend instance to use.
   * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler
   *   The module handler to invoke the alter hook with.
   */
  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler) {
    parent::__construct($type, $namespaces, $cache_backend, $module_handler, 'Drupal\\migrate\\Annotation\\MigrateSource');
  }

  /**
   * {@inheritdoc}
   */
  protected function getDiscovery() {
    if (!$this->discovery) {
      $discovery = new AnnotatedClassDiscoveryAutomatedProviders($this->subdir, $this->namespaces, $this->pluginDefinitionAnnotationName, $this->additionalAnnotationNamespaces);
      $this->discovery = new ContainerDerivativeDiscoveryDecorator($discovery);
    }
    return $this->discovery;
  }

  /**
   * Finds plugin definitions.
   *
   * @return array
   *   List of definitions to store in cache.
   *
   * @todo This is a temporary solution to the fact that migration source
   *   plugins have more than one provider. This functionality will be moved to
   *   core in https://www.drupal.org/node/2786355.
   */
  protected function findDefinitions() {
    $definitions = $this
      ->getDiscovery()
      ->getDefinitions();
    foreach ($definitions as $plugin_id => &$definition) {
      $this
        ->processDefinition($definition, $plugin_id);
    }
    $this
      ->alterDefinitions($definitions);
    return ProviderFilterDecorator::filterDefinitions($definitions, function ($provider) {
      return $this
        ->providerExists($provider);
    });
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DiscoveryInterface::getDefinition public function Gets a specific plugin definition. 2
DiscoveryInterface::getDefinitions public function Gets the definition of all plugins for this type. 3
DiscoveryInterface::hasDefinition public function Indicates if a specific plugin definition exists.
MapperInterface::getInstance public function Gets or creates a plugin instance that satisfies the given options. 2
MigratePluginManager::createInstance public function Creates a pre-configured instance of a migration plugin. Overrides MigratePluginManagerInterface::createInstance 1
MigrateSourcePluginManager::findDefinitions protected function Finds plugin definitions.
MigrateSourcePluginManager::getDiscovery protected function
MigrateSourcePluginManager::__construct public function MigrateSourcePluginManager constructor. Overrides MigratePluginManager::__construct