function DefaultLazyPluginCollection::getConfiguration

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::getConfiguration()
  2. 10 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;
}

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