function DefaultLazyPluginCollection::setConfiguration

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

Overrides LazyPluginCollection::setConfiguration

File

core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php, line 130

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function setConfiguration(array $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;
}

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