You are here

public function AddressDisplayFormatter::settingsSummary in Address Display 8

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/AddressDisplayFormatter.php, line 193

Class

AddressDisplayFormatter
Plugin implementation of the 'Address Display' formatter.

Namespace

Drupal\address_display\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $config = $this
    ->getSetting('address_display');
  $labels = $this
    ->getLabels();
  $summary = [];
  $display = [];
  foreach ($config as $key => $config_item) {
    if ($config_item['display']) {
      $display[] = $labels[$key];
    }
  }
  if (!empty($display)) {
    $summary[] = $this
      ->t('Display: @elements', [
      '@elements' => implode(', ', $display),
    ]);
  }
  return $summary;
}