You are here

public function FileDownloadSettingsForm::submitForm in File Download 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

modules/file_download_counter/src/FileDownloadSettingsForm.php, line 86

Class

FileDownloadSettingsForm
Configure statistics settings for this site.

Namespace

Drupal\file_download_counter

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('file_download_counter.settings')
    ->set('count_downloads', $form_state
    ->getValue('file_download_counter_count_downloads'))
    ->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);
}