You are here

public function FieldFormatterWithInlineSettings::settingsSummary in (Entity Reference) Field Formatters 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings::settingsSummary()
  2. 3.x src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php \Drupal\field_formatter\Plugin\Field\FieldFormatter\FieldFormatterWithInlineSettings::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 FieldFormatterBase::settingsSummary

File

src/Plugin/Field/FieldFormatter/FieldFormatterWithInlineSettings.php, line 332

Class

FieldFormatterWithInlineSettings
Plugin implementation of the 'link' formatter.

Namespace

Drupal\field_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = parent::settingsSummary();
  if ($type = $this
    ->getSetting('type')) {
    $summary[] = $this
      ->t('Formatter %type used.', [
      '%type' => $type,
    ]);
  }
  else {
    $summary[] = $this
      ->t('Formatter not configured.');
  }
  return $summary;
}