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

Manages migrate plugins.

Hierarchy

Expanded class hierarchy of MigratePluginManager

See also

hook_migrate_info_alter()

\Drupal\migrate\Annotation\MigrateSource

\Drupal\migrate\Plugin\MigrateSourceInterface

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

\Drupal\migrate\Annotation\MigrateProcessPlugin

\Drupal\migrate\Plugin\MigrateProcessInterface

\Drupal\migrate\Plugin\migrate\process\ProcessPluginBase

Plugin API

Related topics

2 files declare their use of MigratePluginManager
FieldMigration.php in core/modules/migrate_drupal/src/Plugin/migrate/FieldMigration.php
MigrateFieldPluginManager.php in core/modules/migrate_drupal/src/Plugin/MigrateFieldPluginManager.php
1 string reference to 'MigratePluginManager'
migrate.services.yml in core/modules/migrate/migrate.services.yml
core/modules/migrate/migrate.services.yml
2 services use MigratePluginManager
plugin.manager.migrate.id_map in core/modules/migrate/migrate.services.yml
Drupal\migrate\Plugin\MigratePluginManager
plugin.manager.migrate.process in core/modules/migrate/migrate.services.yml
Drupal\migrate\Plugin\MigratePluginManager

File

core/modules/migrate/src/Plugin/MigratePluginManager.php, line 24

Namespace

Drupal\migrate\Plugin
View source
class MigratePluginManager extends DefaultPluginManager implements MigratePluginManagerInterface {

  /**
   * Constructs a MigratePluginManager object.
   *
   * @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.
   * @param string $annotation
   *   (optional) The annotation class name. Defaults to
   *   'Drupal\Component\Annotation\PluginID'.
   */
  public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $annotation = 'Drupal\\Component\\Annotation\\PluginID') {
    parent::__construct("Plugin/migrate/{$type}", $namespaces, $module_handler, NULL, $annotation);
    $this
      ->alterInfo('migrate_' . $type . '_info');
    $this
      ->setCacheBackend($cache_backend, 'migrate_plugins_' . $type);
  }

  /**
   * {@inheritdoc}
   */
  public function createInstance($plugin_id, array $configuration = [], MigrationInterface $migration = NULL) {
    $plugin_definition = $this
      ->getDefinition($plugin_id);
    $plugin_class = DefaultFactory::getPluginClass($plugin_id, $plugin_definition);

    // If the plugin provides a factory method, pass the container to it.
    if (is_subclass_of($plugin_class, 'Drupal\\Core\\Plugin\\ContainerFactoryPluginInterface')) {
      $plugin = $plugin_class::create(\Drupal::getContainer(), $configuration, $plugin_id, $plugin_definition, $migration);
    }
    else {
      $plugin = new $plugin_class($configuration, $plugin_id, $plugin_definition, $migration);
    }
    return $plugin;
  }

}

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
MigratePluginManager::__construct public function Constructs a MigratePluginManager object. 3