You are here

public function GoogleGeocoderBase::getOptionsForm in Geolocation Field 8.2

Same name and namespace in other branches
  1. 8.3 modules/geolocation_google_maps/src/GoogleGeocoderBase.php \Drupal\geolocation_google_maps\GoogleGeocoderBase::getOptionsForm()

Return additional options form.

Return value

array Options form.

Overrides GeocoderBase::getOptionsForm

File

modules/geolocation_google_maps/src/GoogleGeocoderBase.php, line 165

Class

GoogleGeocoderBase
Base class.

Namespace

Drupal\geolocation_google_maps

Code

public function getOptionsForm() {
  $settings = $this
    ->getSettings();
  $form = parent::getOptionsForm();
  $form += [
    'component_restrictions' => [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Component Restrictions'),
      '#description' => $this
        ->t('See <a href="https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering">Component Filtering</a>'),
      'route' => [
        '#type' => 'textfield',
        '#default_value' => $settings['component_restrictions']['route'],
        '#title' => $this
          ->t('Route'),
        '#size' => 15,
      ],
      'locality' => [
        '#type' => 'textfield',
        '#default_value' => $settings['component_restrictions']['locality'],
        '#title' => $this
          ->t('Locality'),
        '#size' => 15,
      ],
      'administrative_area' => [
        '#type' => 'textfield',
        '#default_value' => $settings['component_restrictions']['administrative_area'],
        '#title' => $this
          ->t('Administrative Area'),
        '#size' => 15,
      ],
      'postal_code' => [
        '#type' => 'textfield',
        '#default_value' => $settings['component_restrictions']['postal_code'],
        '#title' => $this
          ->t('Postal code'),
        '#size' => 5,
      ],
      'country' => [
        '#type' => 'textfield',
        '#default_value' => $settings['component_restrictions']['country'],
        '#title' => $this
          ->t('Country'),
        '#size' => 5,
      ],
    ],
    'boundary_restriction' => [
      '#type' => 'fieldset',
      '#title' => $this
        ->t('Boundary Restriction'),
      '#description' => $this
        ->t('See <a href="https://developers.google.com/maps/documentation/geocoding/intro#Viewports">Viewports</a>'),
      'south' => [
        '#type' => 'textfield',
        '#default_value' => $settings['boundary_restriction']['south'],
        '#title' => $this
          ->t('South'),
        '#size' => 15,
      ],
      'west' => [
        '#type' => 'textfield',
        '#default_value' => $settings['boundary_restriction']['west'],
        '#title' => $this
          ->t('West'),
        '#size' => 15,
      ],
      'north' => [
        '#type' => 'textfield',
        '#default_value' => $settings['boundary_restriction']['north'],
        '#title' => $this
          ->t('North'),
        '#size' => 15,
      ],
      'east' => [
        '#type' => 'textfield',
        '#default_value' => $settings['boundary_restriction']['east'],
        '#title' => $this
          ->t('East'),
        '#size' => 15,
      ],
    ],
  ];
  return $form;
}