You are here

public function WebformVariantBase::setConfiguration in Webform 8.5

Same name and namespace in other branches
  1. 6.x src/Plugin/WebformVariantBase.php \Drupal\webform\Plugin\WebformVariantBase::setConfiguration()

Sets the configuration for this plugin instance.

Parameters

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

Overrides ConfigurableInterface::setConfiguration

1 call to WebformVariantBase::setConfiguration()
WebformVariantBase::__construct in src/Plugin/WebformVariantBase.php
Constructs a WebformVariantBase object.

File

src/Plugin/WebformVariantBase.php, line 305

Class

WebformVariantBase
Provides a base class for a webform variant.

Namespace

Drupal\webform\Plugin

Code

public function setConfiguration(array $configuration) {
  $configuration += [
    'variant_id' => '',
    'element_key' => '',
    'label' => '',
    'notes' => '',
    'status' => 1,
    'weight' => '',
    'settings' => [],
  ];
  $this->configuration = $configuration['settings'] + $this
    ->defaultConfiguration();
  $this->variant_id = $configuration['variant_id'];
  $this->element_key = $configuration['element_key'];
  $this->label = $configuration['label'];
  $this->notes = $configuration['notes'];
  $this->status = $configuration['status'];
  $this->weight = $configuration['weight'];
  return $this;
}