You are here

public function ContentHubWebhookController::processWebhook in Acquia Content Hub 8

Enables other modules to process the webhook.

Parameters

array $webhook: The webhook sent by the Content Hub.

Return value

\Symfony\Component\HttpFoundation\Response The Response Object.

1 call to ContentHubWebhookController::processWebhook()
ContentHubWebhookController::receiveWebhook in src/Controller/ContentHubWebhookController.php
Process a webhook.

File

src/Controller/ContentHubWebhookController.php, line 276

Class

ContentHubWebhookController
Controller for Content Hub Imported Entities.

Namespace

Drupal\acquia_contenthub\Controller

Code

public function processWebhook(array $webhook) {

  // Process Reindex Webhook.
  if ($webhook['crud'] === 'reindex') {
    $this
      ->processReindexWebhook($webhook);
    return new Response('');
  }
  $assets = isset($webhook['assets']) ? $webhook['assets'] : FALSE;
  if (count($assets) > 0) {
    $this->moduleHandler
      ->alter('acquia_contenthub_process_webhook', $webhook);
  }
  else {
    $message = new FormattableMarkup('Error processing Webhook (It contains no assets): @whook', [
      '@whook' => print_r($webhook, TRUE),
    ]);
    $this->loggerFactory
      ->get('acquia_contenthub')
      ->debug($message);
  }
  return new Response('');
}