You are here

public function MatomoReportsSettings::submitForm in Matomo Reports 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/MatomoReportsSettings.php, line 161

Class

MatomoReportsSettings
Class MatomoReportsSettings.

Namespace

Drupal\matomo_reports\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('matomo_reports.matomoreportssettings')
    ->set('matomo_report_server', $form_state
    ->getValue('matomo_report_server'))
    ->set('matomo_server_url', $form_state
    ->getValue('matomo_server_url'))
    ->set('token_auth', $form_state
    ->getValue('token_auth'))
    ->set('matomo_reports_token_auth', $form_state
    ->getValue('matomo_reports_token_auth'))
    ->set('matomo_reports_sites', $form_state
    ->getValue('matomo_reports_sites'))
    ->set('matomo_reports_allowed_sites', $form_state
    ->getValue('matomo_reports_allowed_sites'))
    ->save();
}