function SystemStateEdit::submitForm

Same name in other branches
  1. 4.x src/Form/SystemStateEdit.php \Drupal\devel\Form\SystemStateEdit::submitForm()

Overrides FormInterface::submitForm

File

src/Form/SystemStateEdit.php, line 156

Class

SystemStateEdit
Form API form to edit a state.

Namespace

Drupal\devel\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) : void {
    // 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'));
    $this->messenger
        ->addMessage($this->t('Variable %variable was successfully edited.', [
        '%variable' => $values['state_name'],
    ]));
    $this->logger
        ->info('Variable %variable was successfully edited.', [
        '%variable' => $values['state_name'],
    ]);
}