You are here

public function DefaultLazyPluginCollection::getConfiguration in Plug 7

Gets the current configuration of all plugins in this collection.

Return value

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

Overrides LazyPluginCollection::getConfiguration

File

lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php, line 109
Contains \Drupal\Core\Plugin\DefaultLazyPluginCollection.

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function getConfiguration() {
  $instances = array();

  // 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 ConfigurablePluginInterface) {
      $instances[$instance_id] = $instance
        ->getConfiguration();
    }
    else {
      $instances[$instance_id] = $this->configurations[$instance_id];
    }
  }

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