You are here

public function GeolocationGoogleMapFormatter::settingsSummary in Geolocation Field 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/GeolocationGoogleMapFormatter.php, line 129

Class

GeolocationGoogleMapFormatter
Plugin implementation of the 'geolocation_googlemap' formatter.

Namespace

Drupal\geolocation\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $summary = [];
  $summary[] = $this
    ->t('Marker set: @marker', [
    '@marker' => $settings['set_marker'] ? $this
      ->t('Yes') : $this
      ->t('No'),
  ]);
  if ($settings['set_marker']) {
    $summary[] = $this
      ->t('Marker Title: @type', [
      '@type' => $settings['title'],
    ]);
    $summary[] = $this
      ->t('Marker Info Text: @type', [
      '@type' => current(explode(chr(10), wordwrap($settings['info_text'], 30))),
    ]);
    if (!empty($settings['common_map'])) {
      $summary[] = $this
        ->t('Common Map Display: Yes');
    }
  }
  $summary = array_merge($summary, $this
    ->getGoogleMapsSettingsSummary($settings));
  return $summary;
}