function DefaultLazyPluginCollection::initializePlugin

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::initializePlugin()
  2. 8.9.x core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::initializePlugin()
  3. 11.x core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::initializePlugin()

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.