You are here

public function HeaderForm::submitForm in CookiePro by OneTrust 2.x

Same name and namespace in other branches
  1. 8 src/Form/HeaderForm.php \Drupal\cookiepro\Form\HeaderForm::submitForm()

Implements FormBuilder::submitForm().

Serialize the user's settings and save it to the Drupal's config Table.

Overrides ConfigFormBase::submitForm

File

src/Form/HeaderForm.php, line 86

Class

HeaderForm
Provide settings page for adding cookiepro header scripts.

Namespace

Drupal\cookiepro\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $this
    ->configFactory()
    ->getEditable('cookiepro.header.settings')
    ->set('scripts', $values['scripts'])
    ->save();
  $messenger = \Drupal::messenger();
  $messenger
    ->addMessage('Your Settings have been saved.', 'status');
}