You are here

public function GeocodeFormatterBase::settingsSummary in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 modules/geocoder_field/src/Plugin/Field/GeocodeFormatterBase.php \Drupal\geocoder_field\Plugin\Field\GeocodeFormatterBase::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

1 call to GeocodeFormatterBase::settingsSummary()
FileGeocodeFormatter::settingsSummary in modules/geocoder_field/src/Plugin/Field/FieldFormatter/FileGeocodeFormatter.php
Returns a short summary for the current formatter settings.
1 method overrides GeocodeFormatterBase::settingsSummary()
FileGeocodeFormatter::settingsSummary in modules/geocoder_field/src/Plugin/Field/FieldFormatter/FileGeocodeFormatter.php
Returns a short summary for the current formatter settings.

File

modules/geocoder_field/src/Plugin/Field/GeocodeFormatterBase.php, line 223

Class

GeocodeFormatterBase
Base Plugin implementation of the Geocode formatter.

Namespace

Drupal\geocoder_field\Plugin\Field

Code

public function settingsSummary() {
  $summary = [];
  $dumper_plugins = $this->dumperPluginManager
    ->getPluginsAsOptions();
  $dumper_plugin = $this
    ->getSetting('dumper');
  $provider_labels = array_map(function (GeocoderProvider $provider) : ?string {
    return $provider
      ->label();
  }, $this
    ->getEnabledGeocoderProviders());
  $summary['providers'] = $this
    ->t('Geocoder providers(s): @provider_ids', [
    '@provider_ids' => !empty($provider_labels) ? implode(', ', $provider_labels) : $this
      ->t('Not set'),
  ]);
  $summary['dumper'] = $this
    ->t('Output format: @format', [
    '@format' => !empty($dumper_plugin) ? $dumper_plugins[$dumper_plugin] : $this
      ->t('Not set'),
  ]);
  return $summary;
}