You are here

public function TelephoneFormatter::settingsSummary in Telephone 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/TelephoneFormatter.php, line 133

Class

TelephoneFormatter
Plugin implementation of the 'telephone_formatter' formatter.

Namespace

Drupal\telephone_formatter\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $formats = self::availableFormats();
  $summary[] = $this
    ->t('Format: @format', [
    '@format' => $formats[$this
      ->getSetting('format')],
  ]);
  $summary[] = $this
    ->t('Link: @link', [
    '@link' => $this
      ->getSetting('link') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($default_country = $this
    ->getSetting('default_country')) {
    $summary[] = $this
      ->t('Default country: @default_country', [
      '@default_country' => $default_country,
    ]);
  }
  return $summary;
}