You are here

public function StaleContentOptionsForm::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

File

src/Form/StaleContentOptionsForm.php, line 129

Class

StaleContentOptionsForm
Class StaleContentOptionsForm.

Namespace

Drupal\fastly\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('fastly.settings')
    ->set('stale_while_revalidate', $form_state
    ->getValue('stale_while_revalidate'))
    ->set('stale_while_revalidate_value', $form_state
    ->getValue('stale_while_revalidate_value'))
    ->set('stale_if_error', $form_state
    ->getValue('stale_if_error'))
    ->set('stale_if_error_value', $form_state
    ->getValue('stale_if_error_value'))
    ->save();
  $this->webhook
    ->sendWebHook($this
    ->t("Fastly module configuration changed on %base_url", [
    '%base_url' => $this->baseUrl,
  ]), "config_save");
  parent::submitForm($form, $form_state);
}