You are here

public function OpenlayersMap::buildOptionsForm in Openlayers 8.4

Overrides \Drupal\views\Plugin\views\style\StylePluginBase\StylePluginBase::buildOptionsForm().

Overrides StylePluginBase::buildOptionsForm

File

src/Plugin/views/style/OpenlayersMap.php, line 89
Definition of Drupal\openlayers\Plugin\views\style\OpenlayersMap.

Class

OpenlayersMap
Style plugin to render geodata on an Openlayers map.

Namespace

Drupal\openlayers\Plugin\views\style

Code

public function buildOptionsForm(&$form, FormStateInterface $form_state) {
  parent::buildOptionsForm($form, $form_state);
  $options = $this->displayHandler
    ->getFieldLabels(TRUE);

  // Get a sublist of geo data fields in the view.
  $fields_geo_data = $this
    ->getAvailableDataSources();
  $form['data_source'] = [
    '#type' => 'select',
    '#title' => $this
      ->t('Geodata Source'),
    '#description' => $this
      ->t('Select the field containing geodata that you wish to use.'),
    '#options' => $fields_geo_data,
    '#default_value' => $this->options['data_source'],
    '#required' => TRUE,
    '#weight' => -10,
  ];

  // Include the Openlayers Map general options.
  $this
    ->includeGeneralOptions($form, $this->options);
}