You are here

public function Leaflet::getSettings in Geolocation Field 8.3

Same name and namespace in other branches
  1. 8.2 modules/geolocation_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapProvider\Leaflet::getSettings()

Provide map provider specific settings ready to handover to JS.

Parameters

array $settings: Current general map settings. Might contain unrelated settings as well.

Return value

array An array only containing keys defined in this plugin.

Overrides MapProviderBase::getSettings

File

modules/geolocation_leaflet/src/Plugin/geolocation/MapProvider/Leaflet.php, line 82

Class

Leaflet
Provides Leaflet maps.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\MapProvider

Code

public function getSettings(array $settings) {
  $settings = parent::getSettings($settings);
  $settings['zoom'] = (int) $settings['zoom'];
  if (empty($settings['minZoom'])) {
    unset($settings['minZoom']);
  }
  else {
    $settings['minZoom'] = (int) $settings['minZoom'];
  }
  if (empty($settings['maxZoom'])) {
    unset($settings['maxZoom']);
  }
  else {
    $settings['maxZoom'] = (int) $settings['maxZoom'];
  }
  return $settings;
}