You are here

function openlayers_behavior_layerswitcher::render in Openlayers 7.2

Same name and namespace in other branches
  1. 6.2 includes/behaviors/openlayers_behavior_layerswitcher.inc \openlayers_behavior_layerswitcher::render()

Render.

Overrides openlayers_behavior::render

File

plugins/behaviors/openlayers_behavior_layerswitcher.inc, line 75
Implementation of OpenLayers behavior.

Class

openlayers_behavior_layerswitcher
Layer Switcher Behavior

Code

function render(&$map) {

  // Legacy code for maps not using the default images now
  // provided with the code, or for maps that dont have images
  // set.  We have to set the rounded corner color and add a
  // class for CSS to style
  if (empty($map['image_path'])) {
    $this->options['roundedCornerColor'] = 'darkblue';
    $this->options['displayClass'] = 'olControlLayerSwitcher legacy';
  }
  if ($this->options['sortBaseLayer'] == 'ASC' || $this->options['sortBaseLayer'] == 'DESC') {
    uasort($map['layers'], 'drupal_sort_title');
    if ($this->options['sortBaseLayer'] == 'ASC') {
      $map['layers'] = array_reverse($map['layers'], TRUE);
    }
  }
  drupal_add_js(drupal_get_path('module', 'openlayers') . '/plugins/behaviors/openlayers_behavior_layerswitcher.js');
  return $this->options;
}