You are here

public function WebhooksTestSubscriber::onWebhookReceive in Webhooks 8

Webhook receive event handler.

Parameters

\Drupal\webhooks\Event\ReceiveEvent $event: Response event.

File

tests/modules/webhooks_test/src/EventSubscriber/WebhooksTestSubscriber.php, line 68

Class

WebhooksTestSubscriber
Webhooks Test event subscriber.

Namespace

Drupal\webhooks_test\EventSubscriber

Code

public function onWebhookReceive(ReceiveEvent $event) {
  $this->state
    ->set(__FUNCTION__, TRUE);
  $webhook = $event
    ->getWebhook();
  $webhook_config = $event
    ->getWebhookConfig();
  $this->state
    ->set(__FUNCTION__ . '_webhook', $webhook);
  $this->state
    ->set(__FUNCTION__ . '_webhook_config', $webhook_config);
  $this->messenger
    ->addStatus(print_r($webhook_config, TRUE));
  $this->messenger
    ->addStatus(print_r($webhook, TRUE));
}