You are here

public function GeocodioSettings::buildForm in Geolocation Field 8.3

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_geocodio/src/Form/GeocodioSettings.php, line 18

Class

GeocodioSettings
Implements the Geocodio form controller.

Namespace

Drupal\geolocation_geocodio\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->get('geolocation_geocodio.settings');
  $form['api_key'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Geocodio API Key'),
    '#default_value' => $config
      ->get('api_key'),
    '#description' => $this
      ->t('Geocodio requires users to sign up at <a href="https://dash.geocod.io/apikey/create">geocod.io</a>.'),
  ];
  $form['fields'] = [
    '#type' => 'textfield',
    '#title' => $this
      ->t('Geocodio Fields'),
    '#default_value' => $config
      ->get('fields'),
    '#description' => $this
      ->t("Fields available in the Geocodio API will be added to results if you add them here in a string delimited list such as 'cd,stateleg'."),
  ];
  return parent::buildForm($form, $form_state);
}