You are here

public function StatisticsSettingsForm::submitForm in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::submitForm()
  2. 10 core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::submitForm()

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

core/modules/statistics/src/StatisticsSettingsForm.php, line 88

Class

StatisticsSettingsForm
Configure statistics settings for this site.

Namespace

Drupal\statistics

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('statistics.settings')
    ->set('count_content_views', $form_state
    ->getValue('statistics_count_content_views'))
    ->save();

  // The popular statistics block is dependent on these settings, so clear the
  // block plugin definitions cache.
  if ($this->moduleHandler
    ->moduleExists('block')) {
    \Drupal::service('plugin.manager.block')
      ->clearCachedDefinitions();
  }
  parent::submitForm($form, $form_state);
}