You are here

public function Popup::optionsForm in Openlayers 7.3

@TODO What is this return? If it is the form, why is form by reference?

Overrides Base::optionsForm

File

src/Plugin/Component/Popup/Popup.php, line 23
Component: Popup.

Class

Popup
Class Popup.

Namespace

Drupal\openlayers\Plugin\Component\Popup

Code

public function optionsForm(array &$form, array &$form_state) {
  $form['options']['frontend_layers'] = array(
    '#type' => 'select',
    '#title' => t('Layers'),
    '#empty_option' => t('- Select a Layer -'),
    '#default_value' => $this
      ->getOption('frontend_layers', ''),
    '#description' => t('Select the layers.'),
    '#options' => Openlayers::loadAllAsOptions('Layer'),
    '#required' => TRUE,
    '#multiple' => TRUE,
  );
  $form['options']['closer'] = array(
    '#type' => 'checkbox',
    '#title' => t('Display close button ?'),
    '#default_value' => $this
      ->getOption('closer', FALSE),
  );
  $form['options']['positioning'] = array(
    '#type' => 'select',
    '#title' => t('Positioning'),
    '#default_value' => $this
      ->getOption('positioning', 'top-left'),
    '#description' => t('Defines how the overlay is actually positioned. Default is top-left.'),
    '#options' => Openlayers::positioningOptions(),
    '#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.'),
  );
}