You are here

public function GeofieldGoogleEmbedMapFormatter::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/GeofieldGoogleEmbedMapFormatter.php, line 179

Class

GeofieldGoogleEmbedMapFormatter
Plugin implementation of the 'geofield_embed_google_map' formatter.

Namespace

Drupal\geofield_map_extras\Plugin\Field\FieldFormatter

Code

public function settingsSummary() {
  $settings = $this
    ->getSettings();
  $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'],
    ]),
    'optionals_parameters' => $this
      ->t('Optionals Parameters: @options', [
      '@options' => $settings['optionals_parameters'],
    ]),
  ];

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