You are here

public function LeafletDefaultFormatter::settingsSummary in Leaflet 8

Same name and namespace in other branches
  1. 2.1.x src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php \Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter::settingsSummary()
  2. 2.0.x src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php \Drupal\leaflet\Plugin\Field\FieldFormatter\LeafletDefaultFormatter::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

File

src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php, line 274

Class

LeafletDefaultFormatter
Plugin implementation of the 'leaflet_default' formatter.

Namespace

Drupal\leaflet\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = [];
  $summary[] = $this
    ->t('Leaflet Map: @map', [
    '@map' => $this
      ->getSetting('leaflet_map'),
  ]);
  $summary[] = $this
    ->t('Map height: @height @height_unit', [
    '@height' => $this
      ->getSetting('height'),
    '@height_unit' => $this
      ->getSetting('height_unit'),
  ]);
  $summary[] = $this
    ->t('Popup Infowindow: @popup', [
    '@popup' => $this
      ->getSetting('popup') ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($this
    ->getSetting('popup') && $this
    ->getSetting('popup_content')) {
    $summary[] = $this
      ->t('Popup content: @popup_content', [
      '@popup_content' => $this
        ->getSetting('popup_content'),
    ]);
  }
  return $summary;
}