function LazyPluginCollection::get

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

Gets a plugin instance, initializing it if necessary.

Parameters

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

File

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

Class

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

Namespace

Drupal\Component\Plugin

Code

public function &get($instance_id) {
  if (!isset($this->pluginInstances[$instance_id])) {
    $this->initializePlugin($instance_id);
  }
  return $this->pluginInstances[$instance_id];
}

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