summaryrefslogtreecommitdiffstats
path: root/core/modules/system/tests/modules/theme_suggestions_test/theme_suggestions_test.module
blob: cbc5b380206ab32b423b24ffca0a925a6aa37a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

/**
 * @file
 * Support module for testing theme suggestions.
 */

/**
 * Implements hook_theme().
 */
function theme_suggestions_test_theme() {
  $items['theme_suggestions_test_include'] = [
    'file' => 'theme_suggestions_test.inc',
    'variables' => [],
    'function' => 'theme_theme_suggestions_test_include',
  ];
  return $items;
}

/**
 * Implements hook_theme_suggestions_alter().
 */
function theme_suggestions_test_theme_suggestions_alter(array &$suggestions, array $variables, $hook) {
  \Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
  if ($hook == 'theme_test_general_suggestions') {
    $suggestions[] = $hook . '__module_override';
  }
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_suggestions_alter(array &$suggestions, array $variables) {
  \Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
  $suggestions[] = 'theme_test_suggestions__' . 'module_override';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_function_suggestions_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'theme_test_function_suggestions__' . 'module_override';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_specific_suggestions_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'theme_test_specific_suggestions__' . 'variant__foo';
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function theme_suggestions_test_theme_suggestions_theme_test_suggestions_include_alter(array &$suggestions, array $variables, $hook) {
  $suggestions[] = 'theme_suggestions_test_include';
}