webhooks-8.x-1.x-dev/modules/webhook/webhook.module

modules/webhook/webhook.module
<?php

/**
 * @file
 * Primary module hooks for Webhook module.
 */

use Drupal\Core\Render\Element;

/**
 * Implements hook_theme().
 */
function webhook_theme(): array {
  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): void {
  $variables['view_mode'] = $variables['elements']['#view_mode'];
  foreach (Element::children($variables['elements']) as $key) {
    $variables['content'][$key] = $variables['elements'][$key];
  }
}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc