View source
<?php
class openlayers_plus_behavior_maptext extends openlayers_behavior {
function options_init() {
$options['first'] = array(
'title' => '',
'description' => '',
);
$options['second'] = array(
'title' => '',
'description' => '',
);
$options['third'] = array(
'title' => '',
'description' => '',
);
return $options;
}
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;
}
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;
}
}