You are here

class openlayers_plus_behavior_maptext in OpenLayers Plus 7

Same name and namespace in other branches
  1. 7.3 behaviors/openlayers_plus_behavior_maptext.inc \openlayers_plus_behavior_maptext
  2. 7.2 behaviors/openlayers_plus_behavior_maptext.inc \openlayers_plus_behavior_maptext

Hierarchy

Expanded class hierarchy of openlayers_plus_behavior_maptext

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

File

behaviors/openlayers_plus_behavior_maptext.inc, line 3

View source
class openlayers_plus_behavior_maptext extends openlayers_behavior {

  /**
   * Override of options_init().
   */
  function options_init() {
    $options['first'] = array(
      'title' => '',
      'description' => '',
    );
    $options['second'] = array(
      'title' => '',
      'description' => '',
    );
    $options['third'] = array(
      'title' => '',
      'description' => '',
    );
    return $options;
  }

  /**
   * Override of options_form().
   */
  function options_form($defaults = array()) {
    $options = array(
      'first' => array(
        '#tree' => TRUE,
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#type' => 'fieldset',
        '#title' => t('First Control'),
      ),
      'second' => array(
        '#tree' => TRUE,
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#type' => 'fieldset',
        '#title' => t('Second Control'),
      ),
      'third' => array(
        '#tree' => TRUE,
        '#collapsible' => TRUE,
        '#collapsed' => FALSE,
        '#type' => 'fieldset',
        '#title' => t('Third Control'),
      ),
    );
    foreach (array(
      'first',
      'second',
      'third',
    ) as $key) {
      $options[$key]['title'] = array(
        '#title' => t('Title'),
        '#description' => t('Enter a title for the control.'),
        '#type' => 'textfield',
        '#size' => 25,
        '#default_value' => isset($defaults[$key]['title']) ? $defaults[$key]['title'] : array(),
      );
      $options[$key]['description'] = array(
        '#description' => t('Enter a description for the control'),
        '#title' => t('Description'),
        '#type' => 'textfield',
        '#size' => 100,
        '#default_value' => isset($defaults[$key]['description']) ? $defaults[$key]['description'] : array(),
      );
    }
    return $options;
  }

  /**
   * Render.
   */
  function render(&$map) {
    drupal_add_js(array(
      'openlayers_plus' => $this->options,
    ), 'setting');
    drupal_add_js('misc/jquery.cookie.js', 'file');
    drupal_add_css(drupal_get_path('module', 'openlayers_plus') . '/behaviors/openlayers_plus_behavior_maptext_toggle.css');
    drupal_add_js(drupal_get_path('module', 'openlayers_plus') . '/behaviors/openlayers_plus_behavior_maptext.js');
    return $this->options;
  }

}

Members