You are here

public function LeafletTileLayerOverlay::getSettingsForm in Geolocation Field 8.3

Provide a generic map settings form array.

Parameters

array $settings: The current map settings.

array $parents: Form specific optional prefix.

Return value

array A form array to be integrated in whatever.

Overrides MapFeatureBase::getSettingsForm

File

modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletTileLayerOverlay.php, line 89

Class

LeafletTileLayerOverlay
Provides map tile layer overlay support.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature

Code

public function getSettingsForm(array $settings, array $parents) {
  $settings = array_replace_recursive(self::getDefaultSettings(), $settings);
  $form['tile_layer_overlay'] = [
    '#type' => 'select',
    '#options' => $this
      ->getTileOverlays(),
    '#default_value' => $settings['tile_layer_overlay'],
    '#ajax' => [
      'callback' => [
        $this,
        'addTileOverlaySettingsFormAjax',
      ],
      'wrapper' => 'tile-overlay-settings',
      'effect' => 'fade',
    ],
  ];
  $overlay = explode('.', $settings['tile_layer_overlay'])[0];
  $form['tile_overlay_options'] = LeafletTileLayerOverlay::getOptionsForm($overlay);
  return $form;
}