You are here

public function DefaultLazyPluginCollection::getConfiguration in Drupal 9

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

Gets the current configuration of all plugins in this collection.

Return value

array An array of up-to-date plugin configuration.

Overrides LazyPluginCollection::getConfiguration

2 calls to DefaultLazyPluginCollection::getConfiguration()
ConditionPluginCollection::getConfiguration in core/lib/Drupal/Core/Condition/ConditionPluginCollection.php
Gets the current configuration of all plugins in this collection.
FilterPluginCollection::getConfiguration in core/modules/filter/src/FilterPluginCollection.php
Gets the current configuration of all plugins in this collection.
2 methods override DefaultLazyPluginCollection::getConfiguration()
ConditionPluginCollection::getConfiguration in core/lib/Drupal/Core/Condition/ConditionPluginCollection.php
Gets the current configuration of all plugins in this collection.
FilterPluginCollection::getConfiguration in core/modules/filter/src/FilterPluginCollection.php
Gets the current configuration of all plugins in this collection.

File

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

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function getConfiguration() {
  $instances = [];

  // Store the current order of the instances.
  $current_order = $this->instanceIds;

  // Reorder the instances to match the original order, adding new instances
  // to the end.
  $this->instanceIds = $this->originalOrder + $current_order;
  foreach ($this as $instance_id => $instance) {
    if (PluginHelper::isConfigurable($instance)) {
      $instances[$instance_id] = $instance
        ->getConfiguration();
    }
    else {
      $instances[$instance_id] = $this->configurations[$instance_id];
    }
  }

  // Restore the current order.
  $this->instanceIds = $current_order;
  return $instances;
}