You are here

public function ContentHubCommonActions::getWebhookUrlFromClientOrigin in Acquia Content Hub 8.2

Obtain the webhook from the Client CDF, given origin.

Parameters

string $origin: The origin of the site.

Return value

false|mixed The webhook URL if it can be obtained, FALSE otherwise.

Throws

\Exception

1 call to ContentHubCommonActions::getWebhookUrlFromClientOrigin()
ContentHubCommonActions::requestToRepublishEntity in src/ContentHubCommonActions.php
Request to republish an entity via Webhook.

File

src/ContentHubCommonActions.php, line 456

Class

ContentHubCommonActions
Common actions across the entirety of Content Hub.

Namespace

Drupal\acquia_contenthub

Code

public function getWebhookUrlFromClientOrigin(string $origin) {

  // Obtaining the webhook from the remote origin.
  $cdf = $this
    ->getClient()
    ->getEntity($origin);
  if ($cdf instanceof ClientCDFObject) {
    $webhook = $cdf
      ->getWebhook();
    if (isset($webhook['url'])) {
      return $webhook['url'];
    }
  }
  return FALSE;
}