You are here

public function WebhookDeleteConfirmForm::deleteWebhook in Acquia Content Hub 8.2

Delete webhook.

Parameters

array $form: Form object.

\Drupal\Core\Form\FormStateInterface $form_state: Form state interface object.

File

modules/acquia_contenthub_publisher/src/Form/Webhook/WebhookDeleteConfirmForm.php, line 186

Class

WebhookDeleteConfirmForm
Confirmation form for webhook deletion.

Namespace

Drupal\acquia_contenthub_publisher\Form\Webhook

Code

public function deleteWebhook(array &$form, FormStateInterface $form_state) : void {
  $response = $this->client
    ->deleteWebhook($this->uuid);
  if (!$this
    ->isResponseSuccessful($response, $this
    ->t('delete'), $this
    ->t('webhook'), $this->uuid, $this
    ->messenger())) {
    return;
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('Webhook %uuid has been deleted successfully.', [
    '%uuid' => $this->uuid,
  ]));
  $form_state
    ->setRedirect('acquia_contenthub.subscription_settings');
}