You are here

protected function TamperPluginCollection::initializePlugin in Tamper 8

Initializes and stores a plugin.

Parameters

string $instance_id: The ID of the plugin instance to initialize.

Overrides DefaultLazyPluginCollection::initializePlugin

File

src/TamperPluginCollection.php, line 40

Class

TamperPluginCollection
A collection of tamper plugins.

Namespace

Drupal\tamper

Code

protected function initializePlugin($instance_id) {
  $configuration = isset($this->configurations[$instance_id]) ? $this->configurations[$instance_id] : [];
  if (!isset($configuration[$this->pluginKey])) {
    throw new PluginNotFoundException($instance_id);
  }

  // Pass source definition.
  $configuration['source_definition'] = $this->sourceDefinition;
  $this
    ->set($instance_id, $this->manager
    ->createInstance($configuration[$this->pluginKey], $configuration));
}