You are here

public function PhoneInternationalDefaultWidget::settingsSummary in International Phone 8

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. 3.x 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 109

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'),
    ]);
  }
  return $summary;
}