function webhooks_cache_flush in Webhooks 8
Implements hook_cache_flush().
File
- ./
webhooks.module, line 282 - Contains webhooks.module.
Code
function webhooks_cache_flush() {
/** @var \Drupal\webhooks\WebhooksService $webhooks_service */
$webhooks_service = \Drupal::service('webhooks.service');
$event = implode(':', [
'system',
'cache_flush',
]);
$webhook_configs = $webhooks_service
->loadMultipleByEvent($event);
/** @var \Drupal\webhooks\Entity\WebhookConfig $webhook_config */
foreach ($webhook_configs as $webhook_config) {
$webhook = new Webhook([
'event' => $event,
], [], $event, $webhook_config
->getContentType());
$webhooks_service
->send($webhook_config, $webhook);
}
}