function LazyPluginCollection::set

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

Stores an initialized plugin.

Parameters

string $instance_id: The ID of the plugin instance being stored.

mixed $value: An instantiated plugin.

2 calls to LazyPluginCollection::set()
DefaultLazyPluginCollection::initializePlugin in core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
Initializes and stores a plugin.
DefaultSingleLazyPluginCollection::initializePlugin in core/lib/Drupal/Core/Plugin/DefaultSingleLazyPluginCollection.php
Initializes and stores a plugin.

File

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

Class

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

Namespace

Drupal\Component\Plugin

Code

public function set($instance_id, $value) {
    $this->pluginInstances[$instance_id] = $value;
    $this->addInstanceId($instance_id);
}

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