You are here

public function MobileNumberCountryFormatter::settingsSummary in Mobile Number 8

Same name and namespace in other branches
  1. 2.0.x src/Plugin/Field/FieldFormatter/MobileNumberCountryFormatter.php \Drupal\mobile_number\Plugin\Field\FieldFormatter\MobileNumberCountryFormatter::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/MobileNumberCountryFormatter.php, line 50

Class

MobileNumberCountryFormatter
Plugin implementation of the 'mobile_number_country' formatter.

Namespace

Drupal\mobile_number\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings() + static::defaultSettings();
  if (!empty($settings['type'])) {
    $texts = [
      'name' => t('Show as country name'),
      'code' => t('Show as country code'),
    ];
    $summary[] = $texts[$settings['type']];
  }
  return $summary;
}