You are here

public function Webform::setSettings in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Entity/Webform.php \Drupal\webform\Entity\Webform::setSettings()

Sets the webform settings.

Parameters

array $settings: The structured array containing all the webform setting.

Return value

$this

Overrides WebformInterface::setSettings

2 calls to Webform::setSettings()
Webform::setSetting in src/Entity/Webform.php
Sets a webform setting for a given key.
Webform::setSettingsOverride in src/Entity/Webform.php
Sets the webform settings override.

File

src/Entity/Webform.php, line 973

Class

Webform
Defines the webform entity.

Namespace

Drupal\webform\Entity

Code

public function setSettings(array $settings) {

  // Always apply the default settings.
  $this->settings += static::getDefaultSettings();

  // Now apply new settings.
  foreach ($settings as $name => $value) {
    if (array_key_exists($name, $this->settings)) {
      $this->settings[$name] = $value;
    }
  }
  return $this;
}