You are here

public function CounterSettingsBasic::submitForm in Counter 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/CounterSettingsBasic.php, line 148

Class

CounterSettingsBasic
Class AddForm.

Namespace

Drupal\counter\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $this
    ->config('counter.settings')
    ->set('counter_show_site_counter', $form_state
    ->getValue('counter_show_site_counter'))
    ->set('counter_show_unique_visitor', $form_state
    ->getValue('counter_show_unique_visitor'))
    ->set('counter_registered_user', $form_state
    ->getValue('counter_registered_user'))
    ->set('counter_unregistered_user', $form_state
    ->getValue('counter_unregistered_user'))
    ->set('counter_blocked_user', $form_state
    ->getValue('counter_blocked_user'))
    ->set('counter_published_node', $form_state
    ->getValue('counter_published_node'))
    ->set('counter_unpublished_node', $form_state
    ->getValue('counter_unpublished_node'))
    ->set('counter_show_server_ip', $form_state
    ->getValue('counter_show_server_ip'))
    ->set('counter_show_ip', $form_state
    ->getValue('counter_show_ip'))
    ->set('counter_show_counter_since', $form_state
    ->getValue('counter_show_counter_since'))
    ->set('counter_statistic_today', $form_state
    ->getValue('counter_statistic_today'))
    ->set('counter_statistic_week', $form_state
    ->getValue('counter_statistic_week'))
    ->set('counter_statistic_month', $form_state
    ->getValue('counter_statistic_month'))
    ->set('counter_statistic_year', $form_state
    ->getValue('counter_statistic_year'))
    ->save();
}