You are here

public function WebhookEditForm::submitForm in Acquia Content Hub 8.2

Throws

\Exception

Overrides FormInterface::submitForm

File

modules/acquia_contenthub_publisher/src/Form/Webhook/WebhookEditForm.php, line 72

Class

WebhookEditForm
Class WebhookEditForm.

Namespace

Drupal\acquia_contenthub_publisher\Form\Webhook

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->setRedirect('acquia_contenthub.subscription_settings');
  $options['url'] = trim($form_state
    ->getValue('url'));

  /** @var \Psr\Http\Message\ResponseInterface $response */
  $response = $this->client
    ->updateWebhook($this->uuid, $options);
  if (!$this
    ->isResponseSuccessful($response, $this
    ->t('update'), $this
    ->t('webhook'), $this->uuid, $this
    ->messenger())) {
    return;
  }
  $this
    ->messenger()
    ->addStatus($this
    ->t('Webhook %uuid has been updated.', [
    '%uuid' => $this->uuid,
  ]));
}