You are here

public function LinkAllyFormatter::settingsSummary in Element Class Formatter 8

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/LinkAllyFormatter.php, line 102

Class

LinkAllyFormatter
Defines a formatter that allows links with screenreader only text.

Namespace

Drupal\element_class_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  $class = $this
    ->getSetting('class');
  if ($link_text = $this
    ->getSetting('link_text')) {
    $summary[] = $this
      ->t('Link text: @text', [
      '@text' => $link_text,
    ]);
  }
  if ($screenreader_text = $this
    ->getSetting('screenreader_text')) {
    $summary[] = $this
      ->t('Screenreader text: @text', [
      '@text' => $screenreader_text,
    ]);
  }
  if ($tag = $this
    ->getSetting('tag')) {
    $summary[] = $this
      ->t('Tag: @tag', [
      '@tag' => $tag,
    ]);
  }
  return $this
    ->elementClassSettingsSummary($summary, $class);
}