function LazyPluginCollection::addInstanceId

Same name in other branches
  1. 9 core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::addInstanceId()
  2. 8.9.x core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::addInstanceId()
  3. 10 core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::addInstanceId()

Adds an instance ID to the available instance IDs.

Parameters

string $id: The ID of the plugin instance to add.

array|null $configuration: (optional) The configuration used by this instance. Defaults to NULL.

3 calls to LazyPluginCollection::addInstanceId()
DefaultLazyPluginCollection::addInstanceId in core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
Adds an instance ID to the available instance IDs.
DefaultSingleLazyPluginCollection::addInstanceId in core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php
Adds an instance ID to the available instance IDs.
LazyPluginCollection::set in core/lib/Drupal/Component/Plugin/LazyPluginCollection.php
Stores an initialized plugin.
2 methods override LazyPluginCollection::addInstanceId()
DefaultLazyPluginCollection::addInstanceId in core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
Adds an instance ID to the available instance IDs.
DefaultSingleLazyPluginCollection::addInstanceId in core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php
Adds an instance ID to the available instance IDs.

File

core/lib/Drupal/Component/Plugin/LazyPluginCollection.php, line 118

Class

LazyPluginCollection
Defines an object which stores multiple plugin instances to lazy load them.

Namespace

Drupal\Component\Plugin

Code

public function addInstanceId($id, $configuration = NULL) {
    if (!isset($this->instanceIds[$id])) {
        $this->instanceIds[$id] = $id;
    }
}

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