You are here

public function StickynavSettingsForm::submitForm in Sticky Navigation 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/StickynavSettingsForm.php, line 99

Class

StickynavSettingsForm
Build Sticky Navigation settings form.

Namespace

Drupal\stickynav\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $theme = $form_state
    ->getValue('theme');
  $config = $this
    ->config('stickynav.settings.' . $theme);
  $config
    ->set('enabled', $form_state
    ->getValue('enabled'))
    ->set('selector', $form_state
    ->getValue('selector'))
    ->set('offset', $form_state
    ->getValue('offset'))
    ->set('custom_offset', $form_state
    ->getValue('custom_offset'))
    ->set('roles', array_keys(array_filter($form_state
    ->getValue('roles'))))
    ->save();
  $form_state
    ->setRedirect('stickynav.set_admin');
  parent::submitForm($form, $form_state);
}