/**
  * @inheritdoc
  */
 public function optionsForm($delta, $qt)
 {
     $tab = $this->settings;
     $form = array();
     $form['Openlayers-map']['map'] = array('#type' => 'select', '#title' => t('Openlayers map'), '#options' => \Drupal\openlayers\Openlayers::loadAllAsOptions('Map'), "#empty_option" => t('- Select a map -'), '#default_value' => isset($tab['openlayers_map']) ? $tab['openlayers_map'] : '');
     return $form;
 }
Esempio n. 2
0
 /**
  * {@inheritdoc}
  */
 public function options_form(&$form_state)
 {
     $form = array();
     // Map objects.
     $form['map'] = array('#type' => 'select', '#title' => t('Openlayers map'), '#description' => t('Map to display.'), '#options' => \Drupal\openlayers\Openlayers::loadAllAsOptions('Map'), "#empty_option" => t('- Select a Map -'), '#default_value' => $this->options['map'] ? $this->options['map'] : variable_get('openlayers_default_map', 'default'));
     return $form;
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['multi'] = array('#type' => 'checkbox', '#title' => t('Multi select ?'), '#default_value' => $this->getOption('multi', TRUE), '#description' => t('A boolean that determines if the default behaviour should select only single features or all (overlapping) features at the clicked map position. Default is false i.e single select.'));
     $form['options']['condition'] = array('#type' => 'select', '#title' => t('Condition'), '#empty_option' => t('- Select a condition -'), '#default_value' => $this->getOption('condition', ''), '#description' => t('Select the condition.'), '#options' => array('singleClick' => t('Single click'), 'shiftKeyOnly' => t('Shift key only'), 'pointerMove' => t('Pointer move')));
     $form['options']['addCondition'] = array('#type' => 'select', '#title' => t('Add condition'), '#empty_option' => t('- Select an add condition -'), '#default_value' => $this->getOption('addCondition', 'never'), '#description' => t('Select the add condition.'), '#options' => array('never' => t('Never'), 'singleClick' => t('Single click'), 'shiftKeyOnly' => t('Shift key only'), 'pointerMove' => t('Pointer move')));
     $form['options']['toggleCondition'] = array('#type' => 'select', '#title' => t('Toggle condition'), '#empty_option' => t('- Select a toggle condition -'), '#default_value' => $this->getOption('toggleCondition', 'shiftKeyOnly'), '#description' => t('Select the toggle condition.'), '#options' => array('never' => t('Never'), 'singleClick' => t('Single click'), 'shiftKeyOnly' => t('Shift key only'), 'pointerMove' => t('Pointer move')));
     $form['options']['style'] = array('#type' => 'select', '#title' => t('Style'), '#empty_option' => t('- Select a Style -'), '#default_value' => $this->getOption('style', ''), '#description' => t('Select the source.'), '#options' => Openlayers::loadAllAsOptions('Style'), '#required' => TRUE);
 }
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['layers'] = array('#type' => 'select', '#title' => t('Layers'), '#empty_option' => t('- Select a Layer -'), '#default_value' => isset($form_state['item']->options['layers']) ? $form_state['item']->options['layers'] : '', '#description' => t('Select the layers.'), '#options' => \Drupal\openlayers\Openlayers::loadAllAsOptions('Layer'), '#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.'));
 }
Esempio n. 5
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#empty_option' => t('- Select a Source -'), '#default_value' => $this->getOption('source', ''), '#description' => t('Select the source.'), '#options' => Openlayers::loadAllAsOptions('Source'), '#required' => TRUE);
     $form['options']['distance'] = array('#type' => 'textfield', '#title' => t('Cluster distance'), '#default_value' => isset($form_state['item']->options['distance']) ? $form_state['item']->options['distance'] : 50, '#description' => t('Cluster distance.'));
     $zoomDistance = $this->getOption('zoomDistance', array());
     $zoomDistance = array_map(function ($v, $k) {
         return $k . ':' . $v;
     }, $zoomDistance, array_keys($zoomDistance));
     $form['options']['zoomDistance'] = array('#title' => t('Set cluster distance per zoom level'), '#description' => t('Define a zoom level / cluster distance per line. Use the notation zoom:distance. If no value is given for a zoom level it falls back to the default distance.'), '#type' => 'textarea', '#default_value' => implode(PHP_EOL, array_values($zoomDistance)));
 }
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#empty_option' => t('- Select a Source -'), '#default_value' => isset($form_state['item']->options['source']) ? $form_state['item']->options['source'] : '', '#description' => t('Select the source.'), '#options' => \Drupal\openlayers\Openlayers::loadAllAsOptions('Source'), '#required' => TRUE);
     $form['options']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom'), '#default_value' => isset($form_state['item']->options['zoom']) ? $form_state['item']->options['zoom'] : 10, '#description' => t('Integer or <em>auto</em>.'), '#required' => TRUE);
     $form['options']['enableAnimations'] = array('#type' => 'checkbox', '#title' => t('Enable animations'), '#default_value' => isset($form_state['item']->options['enableAnimations']) ? $form_state['item']->options['enableAnimations'] : FALSE, '#description' => t('Enable pan and zoom animation.'));
     $form['options']['animations'] = array('#type' => 'fieldset', '#title' => 'Animations options', '#states' => array('visible' => array('input[name="options[enableAnimations]"' => array('checked' => TRUE))));
     $form['options']['animations']['pan'] = array('#type' => 'textfield', '#title' => t('Pan animation duration'), '#default_value' => isset($form_state['item']->options['animations']['pan']) ? $form_state['item']->options['animations']['pan'] : '500', '#description' => t('Duration of the pan animation.'));
     $form['options']['animations']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom animation duration'), '#default_value' => isset($form_state['item']->options['animations']['zoom']) ? $form_state['item']->options['animations']['zoom'] : '500', '#description' => t('Duration of the zoom animation.'));
     $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);
 }
Esempio n. 7
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#empty_option' => t('- Select a Source -'), '#default_value' => isset($form_state['item']->options['source']) ? $form_state['item']->options['source'] : '', '#description' => t('Select the source.'), '#options' => \Drupal\openlayers\Openlayers::loadAllAsOptions('Source'), '#required' => TRUE, '#multiple' => TRUE);
     $form['options']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom'), '#default_value' => isset($form_state['item']->options['zoom']) ? $form_state['item']->options['zoom'] : 10, '#description' => t('Integer or <em>auto</em> or <em>disabled</em>.'), '#required' => TRUE);
     $form['options']['max_zoom'] = array('#type' => 'textfield', '#title' => t('Max Zoom'), '#default_value' => isset($form_state['item']->options['max_zoom']) ? $form_state['item']->options['max_zoom'] : 0, '#description' => t('Define the max zoom for the autozoom. Disabled when <em>0</em>.'), '#states' => array('visible' => array('input[name="options[zoom]"' => array('value' => 'auto'))));
     $form['options']['process_once'] = array('#type' => 'checkbox', '#title' => t('Zoom just on map build'), '#default_value' => !empty($form_state['item']->options['process_once']), '#description' => t('If enabled the zoom to source only will fire once at map build. And ignore change events on the source.'));
     $form['options']['enableAnimations'] = array('#type' => 'checkbox', '#title' => t('Enable animations'), '#default_value' => isset($form_state['item']->options['enableAnimations']) ? $form_state['item']->options['enableAnimations'] : FALSE, '#description' => t('Enable pan and zoom animation.'));
     $form['options']['animations'] = array('#type' => 'fieldset', '#title' => 'Animations options', '#states' => array('visible' => array('input[name="options[enableAnimations]"' => array('checked' => TRUE))));
     $form['options']['animations']['pan'] = array('#type' => 'textfield', '#title' => t('Pan animation duration'), '#default_value' => isset($form_state['item']->options['animations']['pan']) ? $form_state['item']->options['animations']['pan'] : '500', '#description' => t('Duration of the pan animation.'));
     $form['options']['animations']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom animation duration'), '#default_value' => isset($form_state['item']->options['animations']['zoom']) ? $form_state['item']->options['animations']['zoom'] : '500', '#description' => t('Duration of the zoom animation.'));
 }
Esempio n. 8
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['dataType'] = array('#type' => 'checkboxes', '#title' => t('Data type'), '#description' => t('If more than one type is choosen a control to select the type to use is displayed when drawing.'), '#multiple' => TRUE, '#options' => array('GeoJSON' => 'GeoJSON', 'KML' => 'KML', 'GPX' => 'GPX', 'WKT' => 'WKT'), '#default_value' => $this->getOption('dataType'), '#required' => TRUE);
     $form['options']['dataProjection'] = array('#type' => 'radios', '#title' => t('Data projection'), '#options' => array('EPSG:4326' => 'EPSG:4326', 'EPSG:3857' => 'EPSG:3857'), '#description' => t('Defines in which projection the data are read and written.'), '#default_value' => $this->getOption('dataProjection', 'EPSG:4326'), '#required' => TRUE);
     $form['options']['featureLimit'] = array('#type' => 'textfield', '#title' => t('Feature limit'), '#description' => t('Limits the number of features. Set to 0 for no limit.'), '#default_value' => $this->getOption('featureLimit'), '#required' => TRUE);
     $form['options']['showInputField'] = array('#type' => 'checkbox', '#title' => t('Show input field'), '#description' => t('Shows the data in a textarea.'), '#default_value' => (int) $this->getOption('showInputField'));
     $form['options']['inputFieldName'] = array('#type' => 'textfield', '#title' => t('Name of the input field'), '#description' => t('Define the name of the input field. You can use brackets to build structure: [geofield][component][data]'), '#default_value' => $this->getOption('inputFieldName'));
     $form['options']['initialData'] = array('#type' => 'textarea', '#title' => t('Initial data'), '#description' => t('Initial data to set. You can use any of the data types available as "Data type". Ensure the data have the same projection as defined in "Data projection".'), '#default_value' => $this->getOption('initialData'));
     $form['options']['editStyle'] = array('#type' => 'select', '#title' => t('Edit style'), '#default_value' => $this->getOption('editStyle'), '#options' => Openlayers::loadAllAsOptions('style'));
     $form['options']['editLayer'] = array('#type' => 'select', '#title' => t('Select the widget layer'), '#default_value' => $this->getOption('editLayer'), '#options' => Openlayers::loadAllAsOptions('layer'));
     $form['options']['editControl'] = array('#type' => 'select', '#title' => t('Select the edit control'), '#default_value' => $this->getOption('editControl'), '#options' => Openlayers::loadAllAsOptions('control'));
 }
Esempio n. 9
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     foreach (Openlayers::getGeometryTypes() as $geometry_type => $geometry) {
         if (!in_array($geometry_type, array('Point', 'LineString', 'Polygon'))) {
             continue;
         }
         $enabled = (bool) $this->getOption(array($geometry_type, 'count'), FALSE);
         $form['options'][$geometry_type] = array('#type' => 'fieldset', '#title' => t('Geometry @geometry', array('@geometry' => $geometry)), '#collapsible' => TRUE, '#collapsed' => !$enabled);
         $form['options'][$geometry_type]['count'] = array('#type' => 'textfield', '#title' => t('Number of features'), '#default_value' => $this->getOption(array($geometry_type, 'count'), 0), '#required' => TRUE);
         $form['options'][$geometry_type]['setRandomStyle'] = array('#type' => 'checkbox', '#title' => t('Set random style on features ?'), '#default_value' => $this->getOption(array($geometry_type, 'setRandomStyle'), 0));
         $form['options'][$geometry_type]['styles'] = array('#type' => 'select', '#title' => t('Styles'), '#empty_option' => t('- Select the Styles -'), '#default_value' => $this->getOption(array($geometry_type, 'styles'), array()), '#description' => t('Select the styles.'), '#options' => Openlayers::loadAllAsOptions('Style'), '#multiple' => TRUE, '#states' => array('visible' => array('input[name="options[' . $geometry_type . '][setRandomStyle]"' => array('checked' => TRUE))));
     }
 }
Esempio n. 10
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'), '#empty_option' => t('- Select a Layer -'), '#multiple' => TRUE, '#default_value' => $this->getOption('layers'), '#options' => Openlayers::loadAllAsOptions('Layer'));
     $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 ((array) $this->getOption('layers') as $i => $machine_name) {
         if (($map_layer = Openlayers::load('Layer', $machine_name)) == TRUE) {
             $label = check_plain($map_layer->getName());
             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->getName())), '#default_value' => $label);
         }
     }
     // @TODO Add configuration for initial visibility. (Adjust JS accordingly)
     // @TODO Add configuration for ordering?
 }
Esempio n. 11
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#empty_option' => t('- Select a Source -'), '#default_value' => isset($form_state['item']->options['source']) ? $form_state['item']->options['source'] : '', '#description' => t('Select the source.'), '#options' => Openlayers::loadAllAsOptions('Source'), '#required' => TRUE);
 }
Esempio n. 12
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['select'] = array('#type' => 'select', '#title' => t('Select interaction'), '#empty_option' => t('- Select an Interaction -'), '#default_value' => $this->getOption('select', ''), '#description' => t('Select the select interaction.'), '#options' => Openlayers::loadAllAsOptions('Interaction'), '#required' => TRUE);
 }
Esempio n. 13
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['layer'] = array('#type' => 'select', '#title' => t('Layer'), '#empty_option' => t('- Select a Layer -'), '#default_value' => isset($form_state['item']->options['layer']) ? $form_state['item']->options['layer'] : '', '#description' => t('Select the layer.'), '#options' => Openlayers::loadAllAsOptions('Layer'), '#required' => 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::positioningOptions(), '#required' => TRUE);
 }
Esempio n. 14
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['style'] = array('#type' => 'select', '#title' => t('Styles'), '#empty_option' => t('- Select the Styles -'), '#default_value' => $this->getOption('style', array()), '#description' => t('Select the source.'), '#options' => Openlayers::loadAllAsOptions('Style'), '#required' => TRUE, '#multiple' => TRUE);
 }
Esempio n. 15
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['layer'] = array('#type' => 'select', '#title' => t('Select the formatter layer'), '#default_value' => $this->getOption('editLayer'), '#options' => Openlayers::loadAllAsOptions('layer'));
 }
Esempio n. 16
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['pixelTolerance'] = array('#type' => 'textfield', '#title' => 'Pixel tolerance', '#description' => 'Pixel tolerance for considering the pointer close enough to a segment or vertex for editing. Default is 10 pixels.', '#default_value' => $this->getOption('pixelTolerance', 10));
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#empty_option' => t('- Select a Source -'), '#default_value' => $this->getOption('source', ''), '#description' => t('Select the vector source.'), '#options' => Openlayers::loadAllAsOptions('Source'), '#required' => TRUE);
 }