You are here

public function MigrationPluginManager::createInstance in Drupal 8

Same name and namespace in other branches
  1. 9 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 99

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