You are here

public function LazyPluginCollection::get in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Component/Plugin/LazyPluginCollection.php \Drupal\Component\Plugin\LazyPluginCollection::get()
  2. 9 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.

1 method overrides LazyPluginCollection::get()
SearchPluginCollection::get in core/modules/search/src/Plugin/SearchPluginCollection.php

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