Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['layers'] = array('#type' => 'select', '#title' => t('Layers'), '#default_value' => isset($form_state['item']->options['layers']) ? $form_state['item']->options['layers'] : '', '#description' => t('Select the layers.'), '#options' => openlayers_layer_options(), '#required' => TRUE, '#multiple' => TRUE);
     $form['options']['positioning'] = array('#type' => 'select', '#title' => t('Positioning'), '#default_value' => isset($form_state['item']->options['positioning']) ? $form_state['item']->options['positioning'] : 'top-left', '#description' => t('Defines how the overlay is actually positioned. Default is top-left.'), '#options' => openlayers_positioning_options(), '#required' => TRUE);
     $form['options']['autoPan'] = array('#type' => 'checkbox', '#title' => t('Autopan'), '#description' => t('If set to true the map is panned when calling setPosition, so that the overlay is entirely visible in the current viewport. The default is false.'), '#default_value' => $this->getOption('autoPan', FALSE));
     $form['options']['autoPanAnimation'] = array('#type' => 'textfield', '#title' => t('Autopan animation duration'), '#default_value' => $this->getOption('autoPanAnimation', 1000), '#description' => t('The options used to create a ol.animation.pan animation. This animation is only used when autoPan is enabled. By default the default options for ol.animation.pan are used. If set to zero the panning is not animated. The duration of the animation is in milliseconds. Default is 1000.'));
     $form['options']['autoPanMargin'] = array('#type' => 'textfield', '#title' => t('Autopan Animation'), '#default_value' => $this->getOption('autoPanMargin', 20), '#description' => t('The margin (in pixels) between the overlay and the borders of the map when autopanning. The default is 20.'));
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['label'] = array('#type' => 'textfield', '#title' => t('Title of the control'), '#default_value' => $this->getOption('label', 'Layers'));
     $form['options']['layers'] = array('#type' => 'select', '#title' => t('Layers'), '#multiple' => TRUE, '#default_value' => $this->getOption('layers'), '#options' => openlayers_layer_options(FALSE));
     $form['options']['multiselect'] = array('#type' => 'checkbox', '#title' => t('Allow selecting multiple layers'), '#default_value' => $this->getOption('multiselect', FALSE));
     $form['options']['layer_labels_hint'] = array('#markup' => t('You need to save the configuration before being able to set custom layer labels.'));
     $labels = $this->getOption('layer_labels', array());
     foreach ($this->getOption('layers') as $i => $machine_name) {
         $map_layer = openlayers_object_load('Layer', $machine_name);
         $label = check_plain($map_layer->name);
         if (isset($labels[$machine_name])) {
             $label = $labels[$machine_name];
         }
         $form['options']['layer_labels'][$machine_name] = array('#type' => 'textfield', '#title' => t('Label for layer @label:', array('@label' => $map_layer->name)), '#default_value' => $label);
     }
     // @TODO Add configuration for initial visibility. (Adjust JS accordingly)
     // @TODO Add configuration for ordering?
 }