theme_suggestions_test.module

Same filename in other branches
  1. 8.9.x core/modules/system/tests/modules/theme_suggestions_test/theme_suggestions_test.module
  2. 10 core/modules/system/tests/modules/theme_suggestions_test/theme_suggestions_test.module
  3. 11.x core/modules/system/tests/modules/theme_suggestions_test/theme_suggestions_test.module

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';
}

Functions

Title Deprecated Summary
theme_suggestions_test_theme_suggestions_alter Implements hook_theme_suggestions_alter().
theme_suggestions_test_theme_suggestions_theme_test_specific_suggestions_alter Implements hook_theme_suggestions_HOOK_alter().
theme_suggestions_test_theme_suggestions_theme_test_suggestions_alter Implements hook_theme_suggestions_HOOK_alter().

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.