You are here

public function LeafletCustomTileLayer::getSettingsForm in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletCustomTileLayer.php \Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature\LeafletCustomTileLayer::getSettingsForm()

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/LeafletCustomTileLayer.php, line 35

Class

LeafletCustomTileLayer
Provides map tile layer support.

Namespace

Drupal\geolocation_leaflet\Plugin\geolocation\MapFeature

Code

public function getSettingsForm(array $settings, array $parents) {
  $settings = $this
    ->getSettings($settings);
  $form['tile_layer_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('URL'),
    '#description' => $this
      ->t('Enter a tile server url like "http://{s}.tile.osm.org/{z}/{x}/{y}.png".'),
    '#default_value' => $settings['tile_layer_url'],
  ];
  $form['tile_layer_attribution'] = [
    '#type' => 'textarea',
    '#title' => $this
      ->t('Attribution'),
    '#description' => $this
      ->t('Enter the tile server attribution like %attr.', [
      '%attr' => htmlspecialchars('&copy; <a href="https://osm.org/copyright">OpenStreetMap</a> contributors'),
    ]),
    '#default_value' => $settings['tile_layer_attribution'],
  ];
  $form['tile_layer_subdomains'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Subdomains'),
    '#description' => $this
      ->t('Enter the tile server subdomains like "abc".'),
    '#default_value' => $settings['tile_layer_subdomains'],
  ];
  $form['tile_layer_zoom'] = [
    '#type' => 'number',
    '#title' => $this
      ->t('Max Zoom'),
    '#description' => $this
      ->t('Enter the tile server max zoom.'),
    '#default_value' => $settings['tile_layer_zoom'],
  ];
  return $form;
}