You are here

public function PhoneInternationalDefaultWidget::settingsSummary in International Phone 3.x

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldWidget/PhoneInternationalDefaultWidget.php \Drupal\phone_international\Plugin\Field\FieldWidget\PhoneInternationalDefaultWidget::settingsSummary()
  2. 8 src/Plugin/Field/FieldWidget/PhoneInternationalDefaultWidget.php \Drupal\phone_international\Plugin\Field\FieldWidget\PhoneInternationalDefaultWidget::settingsSummary()

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides WidgetBase::settingsSummary

File

src/Plugin/Field/FieldWidget/PhoneInternationalDefaultWidget.php, line 97

Class

PhoneInternationalDefaultWidget
Plugin implementation of the 'phone_international_widget' widget.

Namespace

Drupal\phone_international\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $geolocation = $this
    ->getSetting('geolocation');
  $summary[] = t('Use Geolocation: @display_label', [
    '@display_label' => $geolocation ? t('Yes') : 'No',
  ]);
  if (!$geolocation) {
    $summary[] = t('Default selected country: @value', [
      '@value' => $this
        ->getSetting('initial_country'),
    ]);
  }
  $summary[] = t('Exclude Countries: @value', [
    '@value' => implode(",", $this
      ->getSetting('exclude_countries')),
  ]);
  $summary[] = t('Preferred Countries: @value', [
    '@value' => implode(",", $this
      ->getSetting('preferred_countries')),
  ]);
  return $summary;
}