You are here

protected function ContentHubSettingsForm::getFormattedWebhookUrl in Acquia Content Hub 8.2

Returns formatted webhook.

Parameters

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

Return value

string The formatted webhook url.

3 calls to ContentHubSettingsForm::getFormattedWebhookUrl()
ContentHubSettingsForm::updateWebhook in src/Form/ContentHubSettingsForm.php
Updates webhook.
ContentHubSettingsForm::validateForm in src/Form/ContentHubSettingsForm.php
Form validation handler.
ContentHubSettingsForm::validateWebhook in src/Form/ContentHubSettingsForm.php
Validates webhook update.

File

src/Form/ContentHubSettingsForm.php, line 453

Class

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

Namespace

Drupal\acquia_contenthub\Form

Code

protected function getFormattedWebhookUrl(FormStateInterface $form_state) : string {
  $webhook = rtrim($form_state
    ->getValue('webhook'), '/');
  if (strpos($webhook, $this->achPath) === FALSE) {
    $webhook .= $this->achPath;
  }
  $form_state
    ->setValue('webhook', $webhook);
  return $webhook;
}