You are here

class openlayers_plus_behavior_mapeditor in OpenLayers Plus 7.3

mapeditor Behavior

Hierarchy

Expanded class hierarchy of openlayers_plus_behavior_mapeditor

1 string reference to 'openlayers_plus_behavior_mapeditor'
openlayers_plus_openlayers_behaviors in ./openlayers_plus.module
Implements hook_openlayers_behaviors().

File

behaviors/openlayers_plus_behavior_mapeditor.inc, line 10
Implementation of OpenLayers behavior.

View source
class openlayers_plus_behavior_mapeditor extends openlayers_behavior {

  /**
   * Provide initial values for options.
   */
  function options_init() {
    $options = array();
    return $options;
  }

  /**
   * Override of options_form().
   */
  public function options_form($defaults = array()) {
    $options['position'] = array(
      '#type' => 'select',
      '#title' => t('Position'),
      '#options' => array(
        'na' => t('None'),
        'ne' => t('Top right'),
        'se' => t('Bottom right'),
        'sw' => t('Bottom left'),
        'nw' => t('Top left'),
      ),
      '#default_value' => isset($defaults['position']) ? $defaults['position'] : NULL,
    );
    return $options;
  }

  /**
   * Render.
   */
  function render(&$map) {
    $option = array(
      'mapeditorposition' => isset($this->options['position']) ? $this->options['position'] : 0,
    );
    drupal_add_js(array(
      'openlayers_plus' => $option,
    ), 'setting');
    drupal_add_js(drupal_get_path('module', 'openlayers_plus') . '/behaviors/openlayers_plus_behavior_mapeditor.js');
    return $option;
  }

}

Members