function DefaultLazyPluginCollection::getConfiguration

Same name in other branches
  1. 9 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::getConfiguration()
  2. 8.9.x core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::getConfiguration()
  3. 11.x core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::getConfiguration()

Overrides LazyPluginCollection::getConfiguration

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 ($instance instanceof ConfigurableInterface) {
            $instances[$instance_id] = $instance->getConfiguration();
        }
        else {
            $instances[$instance_id] = $this->configurations[$instance_id];
        }
    }
    // Restore the current order.
    $this->instanceIds = $current_order;
    return $instances;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.