You are here

webform_test_handler.module in Webform 6.x

Same filename and directory in other branches
  1. 8.5 tests/modules/webform_test_handler/webform_test_handler.module

Support module for webform that provides handler plugin tests.

File

tests/modules/webform_test_handler/webform_test_handler.module
View source
<?php

/**
 * @file
 * Support module for webform that provides handler plugin tests.
 */
use Drupal\webform\WebformSubmissionInterface;

/**
 * Implements hook_theme().
 */
function webform_test_handler_theme() {
  return [
    'webform_handler_test_summary' => [
      'variables' => [
        'settings' => NULL,
        'handler' => [],
      ],
    ],
    'webform_handler_test_offcanvas_width' => [
      'variables' => [
        'settings' => NULL,
        'handler' => [],
      ],
    ],
  ];
}

/**
 * Implements hook_webform_submissions_pre_purge().
 */
function webform_test_handler_webform_submissions_pre_purge(array $webform_submissions) {
  \Drupal::state()
    ->set('webform_test_purge_hook_pre', array_map(function (WebformSubmissionInterface $submission) {
    return $submission
      ->id();
  }, $webform_submissions));
}

/**
 * Implements hook_webform_submissions_post_purge().
 */
function webform_test_handler_webform_submissions_post_purge(array $webform_submissions) {
  \Drupal::state()
    ->set('webform_test_purge_hook_post', array_map(function (WebformSubmissionInterface $submission) {
    return $submission
      ->id();
  }, $webform_submissions));
}