You are here

public function FieldTokenValueTextFormatter::settingsSummary in Field Token Value 8

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

Class

FieldTokenValueTextFormatter
Provides the Field Token Value Text field formatter.

Namespace

Drupal\field_token_value\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $selected = $this
    ->getSetting('wrapper');
  if (!empty($selected)) {
    $wrapper = $this->wrappers
      ->getDefinition($selected);
    $summary[] = $this
      ->t('Display: @summary', [
      '@summary' => $wrapper['summary'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('No wrapper has been selected so a paragraph tag will be used by default');
  }
  return $summary;
}