You are here

public function ForwardLinkFormatter::settingsSummary in Forward 4.x

Same name and namespace in other branches
  1. 4.0.x src/Plugin/Field/FieldFormatter/ForwardLinkFormatter.php \Drupal\forward\Plugin\Field\FieldFormatter\ForwardLinkFormatter::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/ForwardLinkFormatter.php, line 177

Class

ForwardLinkFormatter
Plugin implementation of the Forward Link formatter.

Namespace

Drupal\forward\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Title: %title', [
    '%title' => $this
      ->getSetting('title'),
  ]);
  switch ($this
    ->getSetting('style')) {
    case 0:
      $summary[] = $this
        ->t('Style: Text only');
      break;
    case 1:
      $summary[] = $this
        ->t('Style: Icon only');
      break;
    case 2:
      $summary[] = $this
        ->t('Style: Icon and text');
      break;
  }
  if ($this
    ->getSetting('style') && $this
    ->getSetting('icon')) {
    $summary[] = $this
      ->t('Icon: %icon', [
      '%icon' => $this
        ->getSetting('icon'),
    ]);
  }
  if ($this
    ->getSetting('nofollow')) {
    $summary[] = $this
      ->t('Tag: A nofollow tag is added to the link');
  }
  return $summary;
}