You are here

public function NominatimGeocodingSettings::buildForm in Geolocation Field 8.2

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

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

modules/geolocation_leaflet/src/Form/NominatimGeocodingSettings.php, line 16

Class

NominatimGeocodingSettings
Class NominatimGeocodingSettings.

Namespace

Drupal\geolocation_leaflet\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->get('geolocation_leaflet.nominatim_settings');
  $form['nominatim_base_url'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Nominatim Base URL Override'),
    '#default_value' => $config
      ->get('nominatim_base_url'),
    '#description' => $this
      ->t('Override URL base to query a custom Nominatim server.'),
  ];
  $form['nominatim_email'] = [
    '#type' => 'email',
    '#title' => $this
      ->t('Custom Email for Nominatim Requests'),
    '#default_value' => $config
      ->get('nominatim_email'),
    '#description' => $this
      ->t('If you are making large numbers of request please include a valid email address. This information will be used to contact you in the event of a problem. Defaults to the site email address.'),
  ];
  return parent::buildForm($form, $form_state);
}