You are here

public function SpamspanSettingsFormTrait::getSetting in SpamSpan filter 8

Same name and namespace in other branches
  1. 8.2 src/SpamspanSettingsFormTrait.php \Drupal\spamspan\SpamspanSettingsFormTrait::getSetting()

Returns the value of a setting, or its default value if absent.

We need to define this method because EmailSpamspanFormatter and FilterSpamspan have different interfaces and FilterSpamspan is missing getSetting() definition. Also for what ever reason because this is a Trait method overloading does not work.

Parameters

string $key: The setting name.

Return value

mixed The setting value.

See also

PluginSettingsBase::getSetting()

2 calls to SpamspanSettingsFormTrait::getSetting()
EmailSpamspanFormatter::settingsSummary in src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php
Returns a short summary for the current formatter settings.
SpamspanSettingsFormTrait::settingsForm in src/SpamspanSettingsFormTrait.php

File

src/SpamspanSettingsFormTrait.php, line 106

Class

SpamspanSettingsFormTrait
Provides a common Settings form for Spamspan plugins.

Namespace

Drupal\spamspan

Code

public function getSetting($key) {

  // Merge defaults if we have no value for the key.
  if (method_exists($this, 'mergeDefaults') && !$this->defaultSettingsMerged && !array_key_exists($key, $this->settings)) {
    $this
      ->mergeDefaults();
  }
  return isset($this->settings[$key]) ? $this->settings[$key] : NULL;
}