You are here

public function FileMiconFormatter::settingsSummary in Micon 8

Same name and namespace in other branches
  1. 2.x src/Plugin/Field/FieldFormatter/FileMiconFormatter.php \Drupal\micon\Plugin\Field\FieldFormatter\FileMiconFormatter::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/FileMiconFormatter.php, line 45

Class

FileMiconFormatter
Plugin implementation of the 'file_micon' formatter.

Namespace

Drupal\micon\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = t('Link title as @title', [
    '@title' => $this
      ->getSetting('title') ? $this
      ->getSetting('title') : 'Default',
  ]);
  if ($position = $this
    ->getSetting('position')) {
    $summary[] = t('Icon position: @value', [
      '@value' => ucfirst($position),
    ]);
  }
  if ($this
    ->getSetting('text_only')) {
    $summary[] = t('Text only');
  }
  else {
    if ($this
      ->getSetting('target')) {
      $summary[] = t('Open link in new window');
    }
  }
  return $summary;
}