You are here

public function PhoneLinkFieldFormatter::settingsSummary in Phone link 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/PhoneLinkFieldFormatter.php, line 83

Class

PhoneLinkFieldFormatter
Plugin implementation of the 'phone_link_field_formatter' formatter.

Namespace

Drupal\phone_link\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  if (!empty($settings['title'])) {
    $summary[] = $this
      ->t('Title attribute: @title', [
      '@title' => $settings['title'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('No title attribute.');
  }
  if (!empty($settings['text'])) {
    $summary[] = $this
      ->t('Text: @text', [
      '@text' => $settings['text'],
    ]);
  }
  else {
    $summary[] = $this
      ->t('No text replacement.');
  }
  if (!empty($settings['type'])) {
    $types = $this
      ->getPhoneTypes();
    $summary[] = $this
      ->t('Phone link type: @type', [
      '@type' => $types[$settings['type']],
    ]);
  }
  return $summary;
}