You are here

public function MigrationPluginManager::createInstance in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::createInstance()
  2. 10 core/modules/migrate/src/Plugin/MigrationPluginManager.php \Drupal\migrate\Plugin\MigrationPluginManager::createInstance()

Creates a pre-configured instance of a plugin.

Parameters

string $plugin_id: The ID of the plugin being instantiated.

array $configuration: An array of configuration relevant to the plugin instance.

Return value

object A fully configured plugin instance.

Throws

\Drupal\Component\Plugin\Exception\PluginException If the instance cannot be created, such as if the ID is invalid.

Overrides PluginManagerBase::createInstance

File

core/modules/migrate/src/Plugin/MigrationPluginManager.php, line 92

Class

MigrationPluginManager
Plugin manager for migration plugins.

Namespace

Drupal\migrate\Plugin

Code

public function createInstance($plugin_id, array $configuration = []) {
  $instances = $this
    ->createInstances([
    $plugin_id,
  ], [
    $plugin_id => $configuration,
  ]);
  return reset($instances);
}