You are here

function openlayers_behavior_layerzoom::options_form in Openlayers 7.2

Overrides openlayers_behavior::options_form

File

plugins/behaviors/openlayers_behavior_layerzoom.inc, line 12
Implementation of OpenLayers behavior.

Class

openlayers_behavior_layerzoom
Layer Zoom Behavior

Code

function options_form($defaults = array()) {
  $options = array();
  foreach ($this->map['layers'] as $layer) {
    if ($layer != $this->map['default_layer']) {
      $options[$layer] = array(
        'enable' => array(
          '#type' => 'checkbox',
          '#title' => t('Enable dynamic zoom levels for @layer', array(
            '@layer' => $layer,
          )),
          '#default_value' => isset($this->options[$layer]['enable']) ? $this->options[$layer]['enable'] : 0,
        ),
        'resolutions' => array(
          '#type' => 'select',
          '#multiple' => TRUE,
          '#options' => array_combine(array_map('strval', openlayers_get_resolutions('EPSG:900913')), range(0, 21)),
          '#title' => t('Zoom Level Range for @layer', array(
            '@layer' => $layer,
          )),
          '#default_value' => isset($this->options[$layer]['resolutions']) ? $this->options[$layer]['resolutions'] : array_map('strval', openlayers_get_resolutions('EPSG:900913')),
          '#description' => t('The zoom levels at which this layer will display.'),
        ),
      );
    }
  }
  return $options;
}