You are here

public function DefaultLazyPluginCollection::__construct in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::__construct()
  2. 9 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::__construct()

Constructs a new DefaultLazyPluginCollection object.

Parameters

\Drupal\Component\Plugin\PluginManagerInterface $manager: The manager to be used for instantiating plugins.

array $configurations: (optional) An associative array containing the initial configuration for each plugin in the collection, keyed by plugin instance ID.

File

core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php, line 61

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function __construct(PluginManagerInterface $manager, array $configurations = []) {
  $this->manager = $manager;
  $this->configurations = $configurations;
  if (!empty($configurations)) {
    $instance_ids = array_keys($configurations);
    $this->instanceIds = array_combine($instance_ids, $instance_ids);

    // Store the original order of the instance IDs for export.
    $this->originalOrder = $this->instanceIds;
  }
}