You are here

public function LeafletTileLayerPluginManager::getLeafletTileLayers in Geofield Map 8

Get the associative array of all defined Leaflet Tile Layers.

File

src/LeafletTileLayer/LeafletTileLayerPluginManager.php, line 46

Class

LeafletTileLayerPluginManager
Provides the Leaflet tile layers plugin plugin manager.

Namespace

Drupal\geofield_map\leafletTileLayer

Code

public function getLeafletTileLayers() {
  $leaflet_tile_layers = [];
  foreach ($this
    ->getDefinitions() as $k => $plugin) {

    // Change tile url protocol if under secure request (Ssl).
    $plugin['url'] = $this->requestStack
      ->getCurrentRequest()
      ->isSecure() ? preg_replace("/^http:/i", "https:", $plugin['url']) : $plugin['url'];
    $leaflet_tile_layers[$k] = [
      'label' => $plugin['label'],
      'url' => $plugin['url'],
      'options' => $plugin['options'],
    ];
  }
  return $leaflet_tile_layers;
}