You are here

public function DefaultLazyPluginCollection::setInstanceConfiguration in Plug 7

Updates the configuration for a plugin instance.

If there is no plugin instance yet, a new will be instantiated. Otherwise, the existing instance is updated with the new configuration.

Parameters

string $instance_id: The ID of a plugin to set the configuration for.

array $configuration: The plugin configuration to set.

2 calls to DefaultLazyPluginCollection::setInstanceConfiguration()
DefaultLazyPluginCollection::addInstanceId in lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
Adds an instance ID to the available instance IDs.
DefaultLazyPluginCollection::setConfiguration in lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php
Sets the configuration for all plugins in this collection.

File

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

Class

DefaultLazyPluginCollection
Provides a default plugin collection for a plugin type.

Namespace

Drupal\Core\Plugin

Code

public function setInstanceConfiguration($instance_id, array $configuration) {
  $this->configurations[$instance_id] = $configuration;
  $instance = $this
    ->get($instance_id);
  if ($instance instanceof ConfigurablePluginInterface) {
    $instance
      ->setConfiguration($configuration);
  }
}