You are here

public function OpenlayersLayer::getAllSources in Openlayers 8.4

File

src/Entity/OpenlayersLayer.php, line 88

Class

OpenlayersLayer
Defines the Openlayers Layer entity.

Namespace

Drupal\openlayers\Entity

Code

public function getAllSources() {
  $sourceNames = \Drupal::service('config.storage')
    ->listAll('openlayers.source');
  $sources = [];
  foreach ($sourceNames as $sourceName) {
    $sourceLabel = \Drupal::config($sourceName)
      ->get('label');
    $sourceName = str_replace('openlayers.source.', '', $sourceName);
    $sources[$sourceName] = $sourceLabel;
  }
  return $sources;
}