function ImageEffectBase::setConfiguration

Same name and namespace in other branches
  1. 9 core/modules/image/src/ImageEffectBase.php \Drupal\image\ImageEffectBase::setConfiguration()
  2. 8.9.x core/modules/image/src/ImageEffectBase.php \Drupal\image\ImageEffectBase::setConfiguration()
  3. 10 core/modules/image/src/ImageEffectBase.php \Drupal\image\ImageEffectBase::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

Overrides ConfigurableTrait::setConfiguration

File

core/modules/image/src/ImageEffectBase.php, line 141

Class

ImageEffectBase
Provides a base class for image effects.

Namespace

Drupal\image

Code

public function setConfiguration(array $configuration) {
  $configuration += [
    'data' => [],
    'uuid' => '',
    'weight' => '',
  ];
  $this->configuration = $configuration['data'] + $this->defaultConfiguration();
  $this->uuid = $configuration['uuid'];
  $this->weight = $configuration['weight'];
  return $this;
}

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