You are here

public function EmailSpamspanFormatter::settingsSummary in SpamSpan filter 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php \Drupal\spamspan\Plugin\Field\FieldFormatter\EmailSpamspanFormatter::settingsSummary()

Returns a short summary for the current formatter settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the formatter has configurable settings.

Return value

string[] A short summary of the formatter settings.

Overrides FormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/EmailSpamspanFormatter.php, line 40

Class

EmailSpamspanFormatter
Plugin implementation of the 'email_mailto' formatter.

Namespace

Drupal\spamspan\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($this
    ->getSetting('spamspan_use_form')) {
    $summary[] = $this
      ->t('Link to a contact form instead of an email address');
  }
  else {
    $summary[] = $this
      ->t('Replacement for "@" is %1', [
      '%1' => $this
        ->getSetting('spamspan_at'),
    ]);
    if ($this
      ->getSetting('spamspan_use_graphic')) {
      $summary[] = $this
        ->t('Use a graphical replacement for "@"');
    }
    if ($this
      ->getSetting('spamspan_dot_enable')) {
      $summary[] = $this
        ->t('Replacement for "." is %1', [
        '%1' => $this
          ->getSetting('spamspan_dot'),
      ]);
    }
  }
  return $summary;
}