You are here

public function OpenlayersService::XXopenlayersMapGetInfo in Openlayers 8.4

Get all available Leaflet map definitions.

Parameters

string $map: The specific map definition string.

Return value

array The leaflet maps definition array.

File

src/OpenlayersService.php, line 126

Class

OpenlayersService
Provides an OpenlayersService class.

Namespace

Drupal\openlayers

Code

public function XXopenlayersMapGetInfo($map = NULL) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['openlayers_map_info'] =& drupal_static(__FUNCTION__);
  }
  $map_info =& $drupal_static_fast['openlayers_map_info'];
  if (empty($map_info)) {
    if ($cached = \Drupal::cache()
      ->get('openlayers_map_info')) {
      $map_info = $cached->data;
    }
    else {
      $map_info = $this->moduleHandler
        ->invokeAll('openlayers_map_info');

      // Let other modules alter the map info.
      $this->moduleHandler
        ->alter('openlayers_map_info', $map_info);
      \Drupal::cache()
        ->set('openlayers_map_info', $map_info);
    }
  }
  if (empty($map)) {
    return $map_info;
  }
  else {
    return isset($map_info[$map]) ? $map_info[$map] : [];
  }
}