You are here

public function SimpleCookieComplianceConfigForm::submitForm in Simple Cookie Compliance 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/SimpleCookieComplianceConfigForm.php, line 78

Class

SimpleCookieComplianceConfigForm
Provides cookie compliance configuration form.

Namespace

Drupal\simple_cookie_compliance\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  \Drupal::service('config.factory')
    ->getEditable('simple_cookie_compliance.settings')
    ->set('message', $form_state
    ->getValue('message'))
    ->set('expires', $form_state
    ->getValue('expires'))
    ->set('no_script', $form_state
    ->getValue('no_script'))
    ->set('agree_button', $form_state
    ->getValue('agree_button'))
    ->save();
  parent::submitForm($form, $form_state);
}