You are here

public function StyledGoogleMapDefaultFormatter::settingsSummary in Styled Google Map 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Field/FieldFormatter/StyledGoogleMapDefaultFormatter.php \Drupal\styled_google_map\Plugin\Field\FieldFormatter\StyledGoogleMapDefaultFormatter::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/StyledGoogleMapDefaultFormatter.php, line 445

Class

StyledGoogleMapDefaultFormatter
Plugin implementation of the 'styled_google_map_default' formatter.

Namespace

Drupal\styled_google_map\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $summary = array();
  $summary[] = $this
    ->t('Width: <b>%width</b><br />Height: <b>%height</b>', array(
    '%width' => $this
      ->getSetting('width'),
    '%height' => $this
      ->getSetting('height'),
  ));
  $style_settings = $this
    ->getSetting('style');
  if ($style_settings['style']) {
    $summary[] = $this
      ->t('<br />Map style: <b>Custom</b>');
  }
  if ($style_settings['pin']) {
    $summary[] = $this
      ->t('<br />Pin style: <b>%pin</b>', array(
      '%pin' => $style_settings['pin'],
    ));
  }
  $summary[] = $this
    ->t('<br />Map type: <b>%maptype</b>', array(
    '%maptype' => $style_settings['maptype'],
  ));
  if ($style_settings['pin']) {
    $summary[] = $this
      ->t('<br />Pin location: <b>%pin</b>', array(
      '%pin' => $style_settings['pin'],
    ));
  }
  $popup_settings = $this
    ->getSetting('popup');
  if ($popup_settings['choice'] == 1) {
    $summary[] = $this
      ->t('<br />Popup shows field <b>%field</b>', array(
      '%field' => $popup_settings['text'],
    ));
    $readable = array(
      FALSE => $this
        ->t('without'),
      TRUE => $this
        ->t('with'),
    );
    $summary[] = $this
      ->t('<b>%label</b> label', array(
      '%label' => $readable[$popup_settings['label']],
    ));
  }
  if ($popup_settings['choice'] == 2) {
    $summary[] = $this
      ->t('<br />Popup shows view mode <b>%viewmode</b>', array(
      '%viewmode' => $popup_settings['view_mode'],
    ));
  }
  $zoom_settings = $this
    ->getSetting('zoom');
  $summary[] = $this
    ->t('<br />Default zoom: <b>%zoom</b>', array(
    '%zoom' => $zoom_settings['default'],
  ));
  $summary[] = $this
    ->t('<br />Maximum zoom: <b>%maxzoom</b>', array(
    '%maxzoom' => $zoom_settings['max'],
  ));
  $summary[] = $this
    ->t('<br />Minimum zoom: <b>%minzoom</b>', array(
    '%minzoom' => $zoom_settings['min'],
  ));
  $gesture_handling = $this
    ->getSetting('gestureHandling');
  $summary[] = $this
    ->t('<br />Gesture handling:<b>%mode</b>', [
    '%mode' => $gesture_handling,
  ]);
  return $summary;
}