public function AppApiKeyRevokeFormBase::submitForm in Apigee Edge 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
- src/
Form/ AppApiKeyRevokeFormBase.php, line 64
Class
- AppApiKeyRevokeFormBase
- Provides revoke confirmation base form for app API key.
Namespace
Drupal\apigee_edge\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$args = [
'%key' => $this->consumerKey,
'@app' => $this->app
->label(),
];
try {
$this
->appCredentialController($this->app
->getAppOwner(), $this->app
->getName())
->setStatus($this->consumerKey, AppCredentialControllerInterface::STATUS_REVOKE);
Cache::invalidateTags($this->app
->getCacheTags());
$this
->messenger()
->addStatus($this
->t('API key %key revoked from @app.', $args));
} catch (\Exception $exception) {
$this
->messenger()
->addError($this
->t('Failed to revoke API key %key from @app.', $args));
}
$form_state
->setRedirectUrl($this
->getCancelUrl());
}