You are here

public function FieldStateBase::setConfiguration in Field States UI 8

Same name and namespace in other branches
  1. 8.2 src/FieldStateBase.php \Drupal\field_states_ui\FieldStateBase::setConfiguration()

Sets the configuration for this plugin instance.

Parameters

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

Overrides ConfigurablePluginInterface::setConfiguration

2 calls to FieldStateBase::setConfiguration()
FieldStateBase::submitConfigurationForm in src/FieldStateBase.php
FieldStateBase::__construct in src/FieldStateBase.php
Constructs a \Drupal\Component\Plugin\PluginBase object.

File

src/FieldStateBase.php, line 127

Class

FieldStateBase
Provides a base class for field staes.

Namespace

Drupal\field_states_ui

Code

public function setConfiguration(array $configuration) {
  $configuration += [
    'data' => [],
    'uuid' => '',
  ];
  $this->configuration = $configuration['data'] + $this
    ->defaultConfiguration();
  if (!$this->configuration['value']) {
    $this->configuration['value'] = TRUE;
  }
  $this->uuid = $configuration['uuid'] ? $configuration['uuid'] : \Drupal::service('uuid')
    ->generate();
  return $this;
}