You are here

public function FastlySettingsForm::submitForm in Fastly 8.3

Form submission handler.

Parameters

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

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

Overrides ConfigFormBase::submitForm

1 call to FastlySettingsForm::submitForm()
FastlySettingsForm::uploadMaintenance in src/Form/FastlySettingsForm.php
Uploads maintenance page and saves configuration.

File

src/Form/FastlySettingsForm.php, line 322

Class

FastlySettingsForm
Class FastlySettingsForm Defines a form to configure module settings.

Namespace

Drupal\fastly\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Set purge credentials state to TRUE if we have made it this far.
  $this->state
    ->setPurgeCredentialsState(TRUE);
  $this
    ->config('fastly.settings')
    ->set('api_key', $form_state
    ->getValue('api_key'))
    ->set('service_id', $form_state
    ->getValue('service_id'))
    ->set('error_maintenance', $form_state
    ->getValue('error_maintenance'))
    ->set('site_id', $form_state
    ->getValue('site_id'))
    ->save();
  $this->webhook
    ->sendWebHook($this
    ->t("Fastly module configuration changed on %base_url", [
    '%base_url' => $this->baseUrl,
  ]), "config_save");
  parent::submitForm($form, $form_state);
}