You are here

public function DefaultLazyPluginCollection::setConfiguration in Zircon Profile 8

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

Sets the configuration for all plugins in this collection.

Parameters

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

Return value

$this

Overrides LazyPluginCollection::setConfiguration

File

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

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function setConfiguration($configuration) {

  // Track each instance ID as it is updated.
  $unprocessed_instance_ids = $this
    ->getInstanceIds();
  foreach ($configuration as $instance_id => $instance_configuration) {
    $this
      ->setInstanceConfiguration($instance_id, $instance_configuration);

    // Remove this instance ID from the list being updated.
    unset($unprocessed_instance_ids[$instance_id]);
  }

  // Remove remaining instances that had no configuration specified for them.
  foreach ($unprocessed_instance_ids as $unprocessed_instance_id) {
    $this
      ->removeInstanceId($unprocessed_instance_id);
  }
  return $this;
}