Same filename and directory in other branches
- 8.9.x core/modules/migrate/src/Plugin/MigratePluginManager.php
- 9 core/modules/migrate/src/Plugin/MigratePluginManager.php
Namespace
Drupal\migrate\Plugin
File
core/modules/migrate/src/Plugin/MigratePluginManager.php
View source
<?php
namespace Drupal\migrate\Plugin;
use Drupal\Component\Plugin\Attribute\AttributeInterface;
use Drupal\Component\Plugin\Attribute\PluginID;
use Drupal\Component\Plugin\Factory\DefaultFactory;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
class MigratePluginManager extends DefaultPluginManager implements MigratePluginManagerInterface {
public function __construct($type, \Traversable $namespaces, CacheBackendInterface $cache_backend, ModuleHandlerInterface $module_handler, $attribute = PluginID::class, $annotation = 'Drupal\\Component\\Annotation\\PluginID') {
if (!is_subclass_of($attribute, AttributeInterface::class)) {
$annotation = $attribute;
$attribute = PluginID::class;
}
parent::__construct("Plugin/migrate/{$type}", $namespaces, $module_handler, NULL, $attribute, $annotation);
$this
->alterInfo('migrate_' . $type . '_info');
$this
->setCacheBackend($cache_backend, 'migrate_plugins_' . $type);
}
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 (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;
}
}
Classes