function ConfigurableTrait::setConfiguration

Sets the configuration for this plugin instance.

The provided configuration is merged with the plugin's default configuration. If the same configuration key exists in both configurations, then the value in the provided configuration will override the default.

Parameters

array $configuration: An associative array containing the plugin's configuration.

Return value

$this

See also

\Drupal\Component\Plugin\ConfigurableInterface::setConfiguration()

4 calls to ConfigurableTrait::setConfiguration()
ConfigurableActionBase::__construct in core/lib/Drupal/Core/Action/ConfigurableActionBase.php
ConfigurablePluginBase::__construct in core/lib/Drupal/Core/Plugin/ConfigurablePluginBase.php
ConfigurableSearchPluginBase::__construct in core/modules/search/src/Plugin/ConfigurableSearchPluginBase.php
ConfigurableTestClass::__construct in core/tests/Drupal/Tests/Core/Plugin/ConfigurableTraitTest.php
Constructs a \Drupal\Component\Plugin\PluginBase object.
2 methods override ConfigurableTrait::setConfiguration()
ImageEffectBase::setConfiguration in core/modules/image/src/ImageEffectBase.php
Sets the configuration for this plugin instance.
WorkflowTypeBase::setConfiguration in core/modules/workflows/src/Plugin/WorkflowTypeBase.php
Sets the configuration for this plugin instance.

File

core/lib/Drupal/Core/Plugin/ConfigurableTrait.php, line 64

Class

ConfigurableTrait
Implementation class for \Drupal\Component\Plugin\ConfigurableInterface.

Namespace

Drupal\Core\Plugin

Code

public function setConfiguration(array $configuration) {
    $this->configuration = NestedArray::mergeDeepArray([
        $this->defaultConfiguration(),
        $configuration,
    ], TRUE);
    return $this;
}

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