function StatisticsSettingsForm::submitForm

Same name in other branches
  1. 9 core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::submitForm()
  2. 8.9.x core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::submitForm()
  3. 11.x core/modules/statistics/src/StatisticsSettingsForm.php \Drupal\statistics\StatisticsSettingsForm::submitForm()

Overrides ConfigFormBase::submitForm

File

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.