You are here

public function OAuthDeleteConsumerForm::submitForm in OAuth 1.0 8.2

Same name and namespace in other branches
  1. 8 src/Form/OAuthDeleteConsumerForm.php \Drupal\oauth\Form\OAuthDeleteConsumerForm::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/OAuthDeleteConsumerForm.php, line 144
Contains \Drupal\oauth\Form\OAuthDeleteConsumerForm.

Class

OAuthDeleteConsumerForm
Provides an oauth_consumer deletion confirmation form.

Namespace

Drupal\oauth\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $key = $values['key'];
  $uid = $values['uid'];
  $this->user_data
    ->delete('oauth', $uid, $key);
  $this
    ->messenger()
    ->addStatus($this
    ->t('OAuth consumer deleted.'));
  Cache::invalidateTags([
    'oauth:' . $uid,
  ]);
  $form_state
    ->setRedirect('oauth.user_consumer', array(
    'user' => $form_state
      ->getValue('uid'),
  ));
}