You are here

public function UsersKeyDeleteForm::submitForm in JSON Web Token Authentication (JWT) 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 FormInterface::submitForm

File

modules/users_jwt/src/Form/UsersKeyDeleteForm.php, line 115

Class

UsersKeyDeleteForm
Class UsersKeyForm.

Namespace

Drupal\users_jwt\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $key = $form_state
    ->getValue('key');
  $this->keyRepository
    ->deleteKey($key->id);
  $this
    ->messenger()
    ->addMessage($this
    ->t('They key %key_id has been deleted', [
    '%key_id' => $key->id,
  ]));
  $form_state
    ->setRedirect('users_jwt.key_list', [
    'user' => $key->uid,
  ]);
}