You are here

public function SettingsForm::submitForm in BugHerd 8

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/SettingsForm.php, line 112

Class

SettingsForm
Class SettingsForm.

Namespace

Drupal\bugherd\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('bugherd.settings')
    ->set('bugherd_project_key', $form_state
    ->getValue('bugherd_project_key'))
    ->set('bugherd_disable_on_admin', $form_state
    ->getValue('bugherd_disable_on_admin'))
    ->set('bugherd_widget_position', $form_state
    ->getValue('bugherd_widget_position'))
    ->save();

  // Clear all pages tagged with BugHerd cache tag.
  $this->cacheTagsInvalidator
    ->invalidateTags([
    'bugherd',
  ]);
}