You are here

public function GeolocationGooglegeocoderWidget::settingsSummary in Geolocation Field 8

Returns a short summary for the current widget settings.

If an empty result is returned, a UI can still be provided to display a settings form in case the widget has configurable settings.

Return value

array A short summary of the widget settings.

Overrides WidgetBase::settingsSummary

File

src/Plugin/Field/FieldWidget/GeolocationGooglegeocoderWidget.php, line 210

Class

GeolocationGooglegeocoderWidget
Plugin implementation of the 'geolocation_googlegeocoder' widget.

Namespace

Drupal\geolocation\Plugin\Field\FieldWidget

Code

public function settingsSummary() {
  $summary = [];
  $settings = $this
    ->getSettings();
  $summary[] = $this
    ->t('Default center longitude @default_longitude and latitude @default_latitude', [
    '@default_longitude' => $settings['default_longitude'],
    '@default_latitude' => $settings['default_latitude'],
  ]);
  if (!empty($settings['auto_client_location'])) {
    $summary[] = $this
      ->t('Will use client location automatically by default');
    if (!empty($settings['auto_client_location_marker'])) {
      $summary[] = $this
        ->t('Will set client location marker automatically by default');
    }
  }
  if (!empty($settings['populate_address_field'])) {
    $summary[] = $this
      ->t('Geocoded address will be stored in @field', [
      '@field' => $settings['target_address_field'],
    ]);
  }
  if (!empty($settings['allow_override_map_settings'])) {
    $summary[] = $this
      ->t('Users will be allowed to override the map settings for each content.');
  }
  $summary = array_merge($summary, $this
    ->getGoogleMapsSettingsSummary($settings));
  return $summary;
}