You are here

public function GeoJSON::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/Source/GeoJSON/GeoJSON.php, line 23
Source: GeoJson.

Class

GeoJSON
Class GeoJSON.

Namespace

Drupal\openlayers\Plugin\Source\GeoJSON

Code

public function optionsForm(array &$form, array &$form_state) {
  $form['options']['url'] = array(
    '#title' => t('URL'),
    '#type' => 'textfield',
    '#maxlength' => '256',
    '#default_value' => $this
      ->getOption('url'),
  );
  $form['options']['useBBOX'] = array(
    '#type' => 'checkbox',
    '#title' => t('Use Bounding Box Strategy'),
    '#description' => t('Bounding Box strategy will add a query string onto the GeoJSON URL, which means that only data in the viewport of the map will be loaded.  This can be helpful if you have lots of data coming from the feed.'),
    '#default_value' => $this
      ->getOption('useBBOX'),
  );
  $form['options']['paramForwarding'] = array(
    '#type' => 'checkbox',
    '#title' => t('Forward parameters on bbox load'),
    '#description' => t('If enabled all GET request parameters will be forwarded when loading the bbox content.'),
    '#default_value' => $this
      ->getOption('paramForwarding', TRUE),
    '#states' => array(
      'invisible' => array(
        ':input[name="options[useBBOX]"]' => array(
          'checked' => FALSE,
        ),
      ),
    ),
  );
  $form['options']['reloadOnZoomChange'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reload features on zoom change.'),
    '#description' => t('Reload the features if the zoom level of the map changes. Handy if you use a zoom aware backend clustering.'),
    '#default_value' => $this
      ->getOption('reloadOnZoomChange'),
  );
  $form['options']['reloadOnExtentChange'] = array(
    '#type' => 'checkbox',
    '#title' => t('Reload features on extent change'),
    '#description' => t('Reload the features if the visible part of the map changes (e.g. by dragging the map).'),
    '#default_value' => $this
      ->getOption('reloadOnExtentChange'),
  );
  $form['options']['geojson_data'] = array(
    '#type' => 'textarea',
    '#title' => t('GeoJSON Data'),
    '#description' => t('Paste raw GeoJSON data here. It is better to use a URL.  This is provided for very simple use cases like one or two features.  If there is data here, it will override the URL above.'),
    '#default_value' => $this
      ->getOption('geojson_data'),
    '#states' => array(
      'invisible' => array(
        ':input[name="options[useBBOX]"]' => array(
          'checked' => TRUE,
        ),
      ),
    ),
  );
  $form['options']['devMode'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable developer mode.'),
    '#description' => t('If enabled you can edit the request to send using a dialog.'),
    '#default_value' => $this
      ->getOption('devMode'),
  );
}