You are here

public function DownloadCountSettingsForm::submitForm in Download Count 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/DownloadCountSettingsForm.php, line 201

Class

DownloadCountSettingsForm
Configure download count settings.

Namespace

Drupal\download_count\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('download_count.settings');
  $config
    ->set('download_count_flood_window', $form_state
    ->getValue('download_count_flood_window'))
    ->set('download_count_flood_limit', $form_state
    ->getValue('download_count_flood_limit'))
    ->set('download_count_sparkline_width', $form_state
    ->getValue('download_count_sparkline_width'))
    ->set('download_count_sparkline_height', $form_state
    ->getValue('download_count_sparkline_height'))
    ->set('download_count_sparkline_min', $form_state
    ->getValue('download_count_sparkline_min'))
    ->set('download_count_sparklines', $form_state
    ->getValue('download_count_sparklines'))
    ->set('download_count_details_yearly_limit', $form_state
    ->getValue('download_count_details_yearly_limit'))
    ->set('download_count_details_monthly_limit', $form_state
    ->getValue('download_count_details_monthly_limit'))
    ->set('download_count_details_weekly_limit', $form_state
    ->getValue('download_count_details_weekly_limit'))
    ->set('download_count_details_daily_limit', $form_state
    ->getValue('download_count_details_daily_limit'))
    ->set('download_count_view_page_items', $form_state
    ->getValue('download_count_view_page_items'))
    ->set('download_count_view_page_limit', $form_state
    ->getValue('download_count_view_page_limit'))
    ->set('download_count_view_page_title', $form_state
    ->getValue('download_count_view_page_title'))
    ->set('download_count_excluded_file_extensions', $form_state
    ->getValue('download_count_excluded_file_extensions'))
    ->save();
  parent::submitForm($form, $form_state);
}