You are here

public function GeocodeFormatterBase::settingsSummary in Geocoder 8.2

Same name and namespace in other branches
  1. 8.3 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 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 191

Class

GeocodeFormatterBase
Base Plugin implementation of the Geocode formatter.

Namespace

Drupal\geocoder_field\Plugin\Field

Code

public function settingsSummary() {
  $summary = [];
  $provider_plugin_ids = $this
    ->getEnabledProviderPlugins();
  $dumper_plugins = $this->dumperPluginManager
    ->getPluginsAsOptions();
  $dumper_plugin = $this
    ->getSetting('dumper');

  // Replace the plugin array with its name.
  array_walk($provider_plugin_ids, function (&$item) {
    $item = $item['name'];
  });
  $summary[] = t('Geocoder plugin(s): @plugin_ids', [
    '@plugin_ids' => !empty($provider_plugin_ids) ? implode(', ', $provider_plugin_ids) : $this
      ->t('Not set'),
  ]);
  $summary[] = t('Output format: @format', [
    '@format' => !empty($dumper_plugin) ? $dumper_plugins[$dumper_plugin] : $this
      ->t('Not set'),
  ]);
  return $summary;
}