You are here

public function HeaderForm::submitForm in Header and Footer Scripts 8.2

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 64

Class

HeaderForm
Provide settings page for adding CSS/JS before the end of body tag.

Namespace

Drupal\header_and_footer_scripts\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $this
    ->configFactory()
    ->getEditable('header_and_footer_scripts.header.settings')
    ->set('styles', $values['styles'])
    ->set('scripts', $values['scripts'])
    ->save();
  drupal_set_message($this
    ->t('Your Settings have been saved.'), 'status');
}