You are here

protected function DefaultLazyPluginCollection::initializePlugin in Drupal 9

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::initializePlugin()

Initializes and stores a plugin.

Parameters

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

Overrides LazyPluginCollection::initializePlugin

2 calls to DefaultLazyPluginCollection::initializePlugin()
DisplayPluginCollection::initializePlugin in core/modules/views/src/DisplayPluginCollection.php
Initializes and stores a plugin.
FilterPluginCollection::initializePlugin in core/modules/filter/src/FilterPluginCollection.php
Initializes and stores a plugin.
2 methods override DefaultLazyPluginCollection::initializePlugin()
DisplayPluginCollection::initializePlugin in core/modules/views/src/DisplayPluginCollection.php
Initializes and stores a plugin.
FilterPluginCollection::initializePlugin in core/modules/filter/src/FilterPluginCollection.php
Initializes and stores a plugin.

File

core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php, line 76

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

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);
  }
  $this
    ->set($instance_id, $this->manager
    ->createInstance($configuration[$this->pluginKey], $configuration));
}