You are here

function leaflet_map_get_info in Leaflet 8

Same name and namespace in other branches
  1. 7 leaflet.module \leaflet_map_get_info()
  2. 2.1.x leaflet.module \leaflet_map_get_info()
  3. 2.0.x leaflet.module \leaflet_map_get_info()

Get all available Leaflet map definitions.

Parameters

string $map: The specific map definition string.

Return value

array The leaflet maps definition array.

8 calls to leaflet_map_get_info()
Leaflet::buildOptionsForm in modules/leaflet_views/src/Plugin/views/style/Leaflet.php
Provide a form to edit options for this plugin.
Leaflet::render in modules/leaflet_views/src/Plugin/views/style/Leaflet.php
Render the display in this style.
LeafletDefaultFormatter::viewElements in src/Plugin/Field/FieldFormatter/LeafletDefaultFormatter.php
This function is called from parent::view().
LeafletDefaultWidget::formElement in src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php
Returns the form for a single field widget.
LeafletDefaultWidget::getLeafletMaps in src/Plugin/Field/FieldWidget/LeafletDefaultWidget.php
Get maps available for use with Leaflet.

... See full list

File

./leaflet.module, line 32
Contains the leaflet.module file.

Code

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

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