You are here

trait WebformPluginSettingsTrait in Webform 6.x

Same name and namespace in other branches
  1. 8.5 src/Plugin/WebformPluginSettingsTrait.php \Drupal\webform\Plugin\WebformPluginSettingsTrait

Provides a plugin settings trait.

Hierarchy

File

src/Plugin/WebformPluginSettingsTrait.php, line 8

Namespace

Drupal\webform\Plugin
View source
trait WebformPluginSettingsTrait {

  /**
   * {@inheritdoc}
   */
  public function getSettings() {
    $configuration = $this
      ->getConfiguration();
    return $configuration['settings'];
  }

  /**
   * {@inheritdoc}
   */
  public function setSettings(array $settings) {
    $configuration = $this
      ->getConfiguration();
    $configuration['settings'] = $settings + $configuration['settings'];
    $this
      ->setConfiguration($configuration);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getSetting($key) {
    $configuration = $this
      ->getConfiguration();
    return isset($configuration['settings'][$key]) ? $configuration['settings'][$key] : NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function setSetting($key, $value) {
    $configuration = $this
      ->getConfiguration();
    $configuration['settings'][$key] = $value;
    return $this
      ->setConfiguration($configuration);
  }

}

Members