You are here

webhook.module in Webhooks 8

Provides a webhook entity type.

File

modules/webhook/webhook.module
View source
<?php

/**
 * @file
 * Provides a webhook entity type.
 */
use Drupal\Core\Render\Element;

/**
 * Implements hook_theme().
 */
function webhook_theme() {
  return [
    'webhook' => [
      'render element' => 'elements',
    ],
  ];
}

/**
 * Prepares variables for webhook templates.
 *
 * Default template: webhook.html.twig.
 *
 * @param array $variables
 *   An associative array containing:
 *   - elements: An associative array containing the webhook information and any
 *     fields attached to the entity.
 *   - attributes: HTML attributes for the containing element.
 */
function template_preprocess_webhook(array &$variables) {
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}

Functions

Namesort descending Description
template_preprocess_webhook Prepares variables for webhook templates.
webhook_theme Implements hook_theme().