You are here

public function GoogleGeocodingAPI::getOptionsForm in Geolocation Field 8

Return additional options form.

Return value

array Options form.

Overrides GeocoderBase::getOptionsForm

File

src/Plugin/geolocation/Geocoder/GoogleGeocodingAPI.php, line 29

Class

GoogleGeocodingAPI
Provides the Google Geocoding API.

Namespace

Drupal\geolocation\Plugin\geolocation\Geocoder

Code

public function getOptionsForm() {
  return [
    'components' => [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Component presets'),
      '#description' => $this
        ->t('See https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering'),
      'route' => [
        '#type' => 'textfield',
        '#default_value' => isset($this->configuration['components']['route']) ? $this->configuration['components']['route'] : '',
        '#title' => $this
          ->t('Route'),
        '#size' => 15,
      ],
      'locality' => [
        '#type' => 'textfield',
        '#default_value' => isset($this->configuration['components']['locality']) ? $this->configuration['components']['locality'] : '',
        '#title' => $this
          ->t('Locality'),
        '#size' => 15,
      ],
      'administrativeArea' => [
        '#type' => 'textfield',
        '#default_value' => isset($this->configuration['components']['administrative_area']) ? $this->configuration['components']['administrativeArea'] : '',
        '#title' => $this
          ->t('Administrative Area'),
        '#size' => 15,
      ],
      'postalCode' => [
        '#type' => 'textfield',
        '#default_value' => isset($this->configuration['components']['postal_code']) ? $this->configuration['components']['postalCode'] : '',
        '#title' => $this
          ->t('Postal code'),
        '#size' => 5,
      ],
      'country' => [
        '#type' => 'textfield',
        '#default_value' => isset($this->configuration['components']['country']) ? $this->configuration['components']['country'] : '',
        '#title' => $this
          ->t('Country'),
        '#size' => 5,
      ],
    ],
  ];
}