public function DefaultLazyPluginCollection::setConfiguration in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php \Drupal\Core\Plugin\DefaultLazyPluginCollection::setConfiguration()
- 10 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 130
Class
- DefaultLazyPluginCollection
- Provides a default plugin collection for a plugin type.
Namespace
Drupal\Core\PluginCode
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;
}