You are here

function _openlayers_layers_process in Openlayers 6.2

Same name and namespace in other branches
  1. 6 includes/openlayers.render.inc \_openlayers_layers_process()
  2. 7.2 includes/openlayers.render.inc \_openlayers_layers_process()

Initialize the layer array into an indexed array of layer objects

Parameters

$layers: Array of layers to process

$map: Map array

Return value

$layer_data Array of initialized layer objects

1 call to _openlayers_layers_process()
openlayers_build_map in ./openlayers.module
Prepare a map for rendering.

File

includes/openlayers.render.inc, line 19
Processing functions for layers and behaviors

Code

function _openlayers_layers_process($layers = array(), &$map = array()) {
  $layer_data = array();
  $weight = 0;
  foreach ($layers as $layer) {
    if ($layer_object = openlayers_layer_load($layer)) {
      $layer_object
        ->render($map);
      $layer_object->data['title'] = $layer_object->title;
      $layer_object->data['weight'] = ++$weight;
      $layer_data[$layer_object->name] = $layer_object->data;
    }
  }
  return $layer_data;
}