You are here

public function HighContrastSwitchForm::submitForm in High contrast 8

Handles the saving of the high contrast state from select and radios. The links are handled via a route.

Overrides FormInterface::submitForm

See also

HighContrastController

File

src/Form/HighContrastSwitchForm.php, line 130

Class

HighContrastSwitchForm
Class HighContrastSwitchForm.

Namespace

Drupal\high_contrast\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('switch') == 1) {
    $this
      ->enableHighContrast();
  }
  else {
    $this
      ->disableHighContrast();
  }
}