You are here

public function LazyPluginCollection::get in Service Container 7

Same name and namespace in other branches
  1. 7.2 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.

1 call to LazyPluginCollection::get()
LazyPluginCollection::getIterator in lib/Drupal/Component/Plugin/LazyPluginCollection.php

File

lib/Drupal/Component/Plugin/LazyPluginCollection.php, line 83
Contains \Drupal\Component\Plugin\LazyPluginCollection.

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];
}