You are here

public function GeofieldGoogleStaticMapFormatter::settingsSummary in Geofield Map 8.2

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

modules/geofield_map_extras/src/Plugin/Field/FieldFormatter/GeofieldGoogleStaticMapFormatter.php, line 253

Class

GeofieldGoogleStaticMapFormatter
Plugin implementation of the 'geofield_static_google_map' formatter.

Namespace

Drupal\geofield_map_extras\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $map_types = $this
    ->getStaticMapOptions();
  $summary = [
    'formatter_intro' => $this
      ->getFormatterIntro(),
    'map_google_api_key' => $this
      ->setMapGoogleApiKeyElement(),
    'map_dimensions' => $this
      ->t('Map dimensions: @width x @height', [
      '@width' => $settings['width'],
      '@height' => $settings['height'],
    ]),
    'zoom_level' => $this
      ->t('Zoom level: @zoom', [
      '@zoom' => $settings['zoom'],
    ]),
    'map_type' => $this
      ->t('Map type: <em>@type</em>', [
      '@type' => $map_types[$settings['static_map_type']],
    ]),
    'marker_color' => $this
      ->t('Markers Size: @marker_size', [
      '@marker_size' => $settings['marker_size'],
    ]),
    'marker_size' => $this
      ->t('Markers Size: @marker_size', [
      '@marker_size' => $settings['marker_size'],
    ]),
  ];

  // Attach Geofield Map Library.
  $summary['library'] = [
    '#attached' => [
      'library' => [
        'geofield_map/geofield_map_general',
      ],
    ],
  ];
  return $summary;
}