You are here

public function AdminForm::submitForm in Form Defaults 8

Toggle the form editor controls on and off

Overrides FormInterface::submitForm

File

src/Form/AdminForm.php, line 45

Class

AdminForm

Namespace

Drupal\Formdefaults\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $editor_enabled = @$_SESSION['formdefaults_enabled'];
  if ($editor_enabled) {
    $_SESSION['formdefaults_enabled'] = FALSE;
    drupal_set_message(t('Form defaults editor is now disabled'));
  }
  else {
    $_SESSION['formdefaults_enabled'] = TRUE;
    drupal_set_message(t('Form defaults editor is now enabled'));
  }
}