You are here

protected function LeafletTileLayerProviders::getProviderOptionsForm in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_leaflet/src/LeafletTileLayerProviders.php \Drupal\geolocation_leaflet\LeafletTileLayerProviders::getProviderOptionsForm()

Provide a form with the provider options.

Parameters

array $settings: An array containing each field value.

Return value

array An array containing the form with the provider options.

2 calls to LeafletTileLayerProviders::getProviderOptionsForm()
LeafletControlLayer::getSettingsForm in modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletControlLayer.php
Provide a generic map settings form array.
LeafletTileLayer::getSettingsForm in modules/geolocation_leaflet/src/Plugin/geolocation/MapFeature/LeafletTileLayer.php
Provide a generic map settings form array.

File

modules/geolocation_leaflet/src/LeafletTileLayerProviders.php, line 26

Class

LeafletTileLayerProviders
Provides tile layer providers list.

Namespace

Drupal\geolocation_leaflet

Code

protected function getProviderOptionsForm(array $settings) {
  $form['Thunderforest']['apikey'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('API key'),
    '#default_value' => isset($settings['Thunderforest']) ? $settings['Thunderforest']['apikey'] : '',
    '#description' => $this
      ->t('Get your @key here <a href="@url">@provider</a>.', [
      '@key' => $this
        ->t('API Key'),
      '@url' => 'https://www.thunderforest.com/',
      '@provider' => 'Thunderforest',
    ]),
  ];
  $form['MapBox']['accessToken'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Access Token'),
    '#default_value' => isset($settings['MapBox']) ? $settings['MapBox']['accessToken'] : '',
    '#description' => $this
      ->t('Get your @key here <a href="@url">@provider</a>.', [
      '@key' => $this
        ->t('Access Token'),
      '@url' => 'https://www.mapbox.com/',
      '@provider' => 'MapBox',
    ]),
  ];
  $form['HERE'] = [
    'app_id' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('APP ID'),
      '#default_value' => isset($settings['HERE']) ? $settings['HERE']['app_id'] : '',
    ],
    'app_code' => [
      '#type' => 'textfield',
      '#title' => $this
        ->t('APP Code'),
      '#default_value' => isset($settings['HERE']) ? $settings['HERE']['app_code'] : '',
      '#description' => $this
        ->t('Get your @key here <a href="@url">@provider</a>.', [
        '@key' => $this
          ->t('APP ID and Code'),
        '@url' => 'http://developer.here.com/',
        '@provider' => 'HERE',
      ]),
    ],
  ];
  $form['GeoportailFrance']['apikey'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('API key'),
    '#default_value' => isset($settings['GeoportailFrance']) ? $settings['GeoportailFrance']['apikey'] : '',
    '#description' => $this
      ->t('Get your @key here <a href="@url">@provider</a>.', [
      '@key' => $this
        ->t('API Key'),
      '@url' => 'http://professionnels.ign.fr/ign/contrats',
      '@provider' => 'GeoportailFrance',
    ]),
  ];
  return $form;
}