You are here

public function MapProviderBase::getSettingsSummary in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 src/MapProviderBase.php \Drupal\geolocation\MapProviderBase::getSettingsSummary()

Provide a summary array to use in field formatters.

Parameters

array $settings: The current map settings.

Return value

array An array to use as field formatter summary.

Overrides MapProviderInterface::getSettingsSummary

4 calls to MapProviderBase::getSettingsSummary()
GoogleMapsProviderBase::getSettingsSummary in modules/geolocation_google_maps/src/GoogleMapsProviderBase.php
Provide a summary array to use in field formatters.
Here::getSettingsSummary in modules/geolocation_here/src/Plugin/geolocation/MapProvider/Here.php
Provide a summary array to use in field formatters.
Leaflet::getSettingsSummary in modules/geolocation_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php
Provide a summary array to use in field formatters.
Yandex::getSettingsSummary in modules/geolocation_yandex/src/Plugin/geolocation/MapProvider/Yandex.php
Provide a summary array to use in field formatters.
4 methods override MapProviderBase::getSettingsSummary()
GoogleMapsProviderBase::getSettingsSummary in modules/geolocation_google_maps/src/GoogleMapsProviderBase.php
Provide a summary array to use in field formatters.
Here::getSettingsSummary in modules/geolocation_here/src/Plugin/geolocation/MapProvider/Here.php
Provide a summary array to use in field formatters.
Leaflet::getSettingsSummary in modules/geolocation_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php
Provide a summary array to use in field formatters.
Yandex::getSettingsSummary in modules/geolocation_yandex/src/Plugin/geolocation/MapProvider/Yandex.php
Provide a summary array to use in field formatters.

File

src/MapProviderBase.php, line 102

Class

MapProviderBase
Class MapProviderBase.

Namespace

Drupal\geolocation

Code

public function getSettingsSummary(array $settings) {
  $summary = [];
  foreach ($this->mapFeatureManager
    ->getMapFeaturesByMapType($this
    ->getPluginId()) as $feature_id => $feature_definition) {
    if (!empty($settings['map_features'][$feature_id]['enabled'])) {
      $feature = $this->mapFeatureManager
        ->getMapFeature($feature_id, []);
      if ($feature) {
        if (!empty($settings['map_features'][$feature_id]['settings'])) {
          $feature_settings = $settings['map_features'][$feature_id]['settings'];
        }
        else {
          $feature_settings = $feature
            ->getSettings([]);
        }
        $summary = array_merge($summary, $feature
          ->getSettingsSummary($feature_settings));
      }
    }
  }
  return $summary;
}