You are here

public function OpenlayersMap::getAllLayers in Openlayers 8.4

File

src/Entity/OpenlayersMap.php, line 179

Class

OpenlayersMap
Defines the Openlayers Map entity.

Namespace

Drupal\openlayers\Entity

Code

public function getAllLayers() {
  $layerNames = \Drupal::service('config.storage')
    ->listAll('openlayers.layer');
  $layers = [];
  foreach ($layerNames as $layerName) {
    $layerLabel = \Drupal::config($layerName)
      ->get('label');
    $layerName = str_replace('openlayers.layer.', '', $layerName);
    $layers[$layerName] = $layerLabel;
  }
  return $layers;
}