Skip to content
Snippets Groups Projects
Commit 3e305fce authored by Stefan Auditor's avatar Stefan Auditor
Browse files

Issue #3472809 by sanduhrs: Implementation help

parent 37a702b4
No related branches found
No related tags found
2 merge requests!34Issue #3302284 by sanduhrs, ant1, datawench, vrs11: Add possibility to set up...,!27Resolve #3472809 "Implementation help 4"
Pipeline #506142 passed
......@@ -8,6 +8,7 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Hook\Attribute\Hook;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Session\AccountInterface;
use Drupal\Core\Url;
use Drupal\user\Entity\User;
use Drupal\user\UserInterface;
use Drupal\webhooks\Webhook;
......@@ -25,8 +26,33 @@ class WebhooksHooks {
switch ($route_name) {
case 'help.page.webhooks':
$output = '';
$output .= '<h3>' . t('Webhooks') . '</h3>';
$output .= '<p>' . t('User-defined HTTP callbacks.') . '</p>';
$output .= '<h2>' . t('About') . '</h2>';
$output .= '<p>' . t('Webhooks are "user-defined HTTP callbacks". They are usually triggered by some event, such as pushing code to a repository or a comment being posted to a blog. When that event occurs, the source site makes an HTTP request to the URI configured for the Webhook. – <a href=":citation">https://en.wikipedia.org/wiki/Webhook</a>.', [
':citation' => 'https://en.wikipedia.org/wiki/Webhook',
]) . '</p>';
$output .= '<p>' . t('This module acts as both a Webhook dispatcher and a Webhook receiver. It is possible to map attributes of the Webhook payload to Webhook entity fields for storage.') . '</p>';
$output .= '<h2>' . t('Uses') . '</h2>';
$output .= '<dl>';
$output .= '<dt><h3>' . t('Dispatching') . '</h3></dt>';
$output .= '<dd>' . t('For dispatching you can <a href=":configure">configure any amount of Webhooks</a> that act on various events like entity create, update, delete and some system hooks like cron, file_download, modules_installed, user_cancel, user_login, user_logout and cache_flush.', [
':configure' => Url::fromRoute('entity.webhook_config.collection')->toString(),
]) . '</dd>';
$output .= '<dt><h3>' . t('Receiving') . '</h3></dt>';
$output .= '<dd>' . t('For receiving you can <a href=":configure">configure any amount of Webhooks</a>, the module captures the request and provides the payload to others with a generic Webhook event.', [
':configure' => Url::fromRoute('entity.webhook_config.collection')->toString(),
]) . '</dd>';
$output .= '<dt><h3>' . t('Storing') . '</h3></dt>';
$output .= '<dd>' . t('The Webhook module implements an entity type that stores every Webhook that has been received. Received Webhooks are stored in a <a href=":configure">dedicated Webhook entity type</a>, if the the type identifier and the Webhook machine name matches. The Webhook entity type is fieldable and you may <a href=":map">map Webhook payload attributes</a> to be stored in the configured fields.', [
':configure' => Url::fromRoute('entity.webhook_type.collection')->toString(),
':map' => Url::fromRoute('webhook.webhook_type.field_mapping', ['webhook_type' => 'webhook'])->toString(),
]) . '</dd>';
$output .= '<dt><h3>' . t('Acting on events') . '</h3></dt>';
$output .= '<dd>' . t('Since Webhooks trigger events and Webhook is an entity with fields that store the data, you can use modules like <a href=":rules">Rules</a> and <a href=":eca">ECA: Event - Condition - Action</a> to react when receiving, sending or storing Webhooks.', [
':rules' => 'https://www.drupal.org/project/rules',
':eca' => 'https://www.drupal.org/project/eca',
]) . '</dd>';
$output .= '</dl>';
$output .= '<p>' . t('Implemented as configuration entity Webhooks are easily deployable.') . '</p>';
return $output;
}
return NULL;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment