You are here

public function SettingsForm::buildForm in Geocoder 8.3

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\geocoder\Form\SettingsForm::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

src/Form/SettingsForm.php, line 66

Class

SettingsForm
The geocoder settings form.

Namespace

Drupal\geocoder\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $config = $this
    ->config('geocoder.settings');
  $geocoder_config_schema = $this->typedConfigManager
    ->getDefinition('geocoder.settings') + [
    'mapping' => [],
  ];
  $geocoder_config_schema = $geocoder_config_schema['mapping'];

  // Attach Geofield Map Library.
  $form['#attached']['library'] = [
    'geocoder/general',
  ];
  $form['geocoder_presave_disabled'] = [
    '#type' => 'checkbox',
    '#title' => $geocoder_config_schema['geocoder_presave_disabled']['label'],
    '#description' => $geocoder_config_schema['geocoder_presave_disabled']['description'],
    '#default_value' => $config
      ->get('geocoder_presave_disabled'),
  ];
  $form['cache'] = [
    '#type' => 'checkbox',
    '#title' => $geocoder_config_schema['cache']['label'],
    '#description' => $geocoder_config_schema['cache']['description'],
    '#default_value' => $config
      ->get('cache'),
  ];
  return parent::buildForm($form, $form_state);
}