_nicemap_get_layers

nicemap/nicemap.module, line 159

Versions
6
_nicemap_get_layers($spec = NULL)

Helper function to retrieve layers & style information and order by custom weight.

▾ 2 functions call _nicemap_get_layers()

nicemap_settings in nicemap/nicemap_admin.inc
Master settings form and testing page
nicemap_settings in nicemap/nicemap_admin.inc
Master settings form and testing page

Code

<?php
function _nicemap_get_layers($spec = NULL) {
  $layers = array();
  if ($spec) {
    if (count($spec['layers'])) {
      $layers = $spec['layers'];
      $weights = variable_get('nicemap_wms_weights', array());
      foreach ($weights as $layer => $weight) {
        if (isset($layers[$layer])) {
          $layers[$layer]['#weight'] = $weight;
        }
      }
    }
  }
  else {
    $styles = variable_get('nicemap_wms_styles', array());
    $weights = variable_get('nicemap_wms_weights', array());
    foreach (variable_get('nicemap_wms_layers', array()) as $layer => $enabled) {
      if ($enabled) {
        $layers[$layer] = array(
          'style' => $styles[$layer],
          '#weight' => isset($weights[$layer]) ? $weights[$layer] : 0,
        );
      }
    }
  }
  uasort($layers, 'element_sort');
  return $layers;
}
?>