You are here

public function ContentHubSettingsForm::suppressWebhook in Acquia Content Hub 8.2

Suppress webhook.

Parameters

array $form: The form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state.

Throws

\Exception

File

src/Form/ContentHubSettingsForm.php, line 589

Class

ContentHubSettingsForm
Defines the form to configure the Content Hub connection settings.

Namespace

Drupal\acquia_contenthub\Form

Code

public function suppressWebhook(array &$form, FormStateInterface $form_state) : void {
  $webhook_uuid = $this->settings
    ->getWebhook('uuid');
  $success = $this->chConnectionManager
    ->suppressWebhook($webhook_uuid);
  if (!$success) {
    $this
      ->messenger()
      ->addError($this
      ->t('Cannot register with env vars, please check your log messages.'));
  }
  $this
    ->config('acquia_contenthub.admin_settings')
    ->set('is_suppressed', TRUE)
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Unregistering ACH was successful.'));
}