openlayers_plus_behavior_popup.inc in OpenLayers Plus 7
File
behaviors/openlayers_plus_behavior_popup.inc
View source
<?php
class openlayers_plus_behavior_popup extends openlayers_behavior {
function options_init() {
return array(
'layers' => array(),
);
}
function options_form($defaults = array()) {
$vector_layers = array();
foreach ($this->map['layers'] as $id => $name) {
$layer = openlayers_layer_load($id);
if (isset($layer->data['vector']) && $layer->data['vector'] == TRUE) {
$vector_layers[$id] = $name;
}
}
return array(
'layers' => array(
'#title' => t('Layers'),
'#type' => 'checkboxes',
'#options' => $vector_layers,
'#description' => t('Select layer to apply popups to.'),
'#default_value' => isset($defaults['layers']) ? $defaults['layers'] : array(),
),
);
}
function render(&$map) {
drupal_add_css(drupal_get_path('module', 'openlayers_plus') . '/behaviors/openlayers_plus_behavior_popup.css');
drupal_add_js(drupal_get_path('module', 'openlayers_plus') . '/behaviors/openlayers_plus_behavior_popup.js');
return $this->options;
}
}