-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhttp_webhooks.module
49 lines (41 loc) · 1.23 KB
/
http_webhooks.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* @file
* Contains http_webhooks.module.
*/
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\http_webhooks\OutgoingWebhook;
/**
* Implements hook_help().
*/
function http_webhooks_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
// Main module help for the http_webhooks module.
case 'help.page.http_webhooks':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('HTTP Webhooks') . '</p>';
return $output;
default:
}
}
/**
* Implements hook_theme().
*/
function http_webhooks_theme() {
return [
'http_webhooks' => [
'render element' => 'children',
],
];
}
function http_webhooks_entity_update(EntityInterface $entity) {
\Drupal::service('http_webhooks.outgoing_webhook')->handle_event($entity, OutgoingWebhook::EVENT_UPDATE);
}
function http_webhooks_entity_create(EntityInterface $entity) {
\Drupal::service('http_webhooks.outgoing_webhook')->handle_event($entity, OutgoingWebhook::EVENT_CREATE);
}
function http_webhooks_entity_delete(EntityInterface $entity) {
\Drupal::service('http_webhooks.outgoing_webhook')->handle_event($entity, OutgoingWebhook::EVENT_DELETE);
}