You are here

theme_suggestions_test.module in Drupal 9

Support module for testing theme suggestions.

File

core/modules/system/tests/modules/theme_suggestions_test/theme_suggestions_test.module
View source
<?php

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

/**
 * 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_specific_suggestions_alter(array &$suggestions, array $variables) {
  $suggestions[] = 'theme_test_specific_suggestions__variant__foo';
}