You are here

public function DefaultLazyPluginCollection::getConfiguration in Drupal 10

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

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