You are here

public function SystemStateEdit::submitForm in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::submitForm()
  2. 8.2 src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::submitForm()
  3. 4.x src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::submitForm()

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 FormInterface::submitForm

File

src/Form/SystemStateEdit.php, line 151

Class

SystemStateEdit
Form API form to edit a state.

Namespace

Drupal\devel\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Save the state
  $values = $form_state
    ->getValues();
  $this->state
    ->set($values['state_name'], $values['parsed_value']);
  $form_state
    ->setRedirectUrl(Url::fromRoute('devel.state_system_page'));
  drupal_set_message($this
    ->t('Variable %variable was successfully edited.', array(
    '%variable' => $values['state_name'],
  )));
  $this
    ->logger('devel')
    ->info('Variable %variable was successfully edited.', array(
    '%variable' => $values['state_name'],
  ));
}