You are here

public function MigratePluginManager::createInstance in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate/src/Plugin/MigratePluginManager.php \Drupal\migrate\Plugin\MigratePluginManager::createInstance()

A specific createInstance method is necessary to pass the migration on.

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 60
Contains \Drupal\migrate\Plugin\MigratePluginManager.

Class

MigratePluginManager
Manages migrate plugins.

Namespace

Drupal\migrate\Plugin

Code

public function createInstance($plugin_id, array $configuration = array(), 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;
}