function MigratePluginManager::createInstance

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

Overrides PluginManagerBase::createInstance

1 call to MigratePluginManager::createInstance()
MigrateDestinationPluginManager::createInstance in core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
A specific createInstance method is necessary to pass the migration on.
1 method overrides MigratePluginManager::createInstance()
MigrateDestinationPluginManager::createInstance in core/modules/migrate/src/Plugin/MigrateDestinationPluginManager.php
A specific createInstance method is necessary to pass the migration on.

File

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

Class

MigratePluginManager
Manages migrate plugins.

Namespace

Drupal\migrate\Plugin

Code

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;
}

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