function ConfigurableTrait::setConfiguration

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Plugin/ConfigurableTrait.php \Drupal\Core\Plugin\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
2 methods override ConfigurableTrait::setConfiguration()
ImageEffectBase::setConfiguration in core/modules/image/src/ImageEffectBase.php
WorkflowTypeBase::setConfiguration in core/modules/workflows/src/Plugin/WorkflowTypeBase.php

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.