test_legacy_theme.theme

Same filename and directory in other branches
  1. 8.9.x core/modules/system/tests/themes/test_legacy_theme/test_legacy_theme.theme

Theme to test functionality of legacy theme functions.

@todo Remove in https://www.drupal.org/project/drupal/issues/3097889

File

core/modules/system/tests/themes/test_legacy_theme/test_legacy_theme.theme

View source
<?php


/**
 * @file
 * Theme to test functionality of legacy theme functions.
 *
 * @todo Remove in https://www.drupal.org/project/drupal/issues/3097889
 */

/**
 * Tests a theme overriding a suggestion of a base theme hook.
 */
function test_legacy_theme_theme_test_preprocess_suggestions__kitten__meerkat($variables) {
    return 'Theme hook implementor=test_theme_theme_test__suggestion(). Foo=' . $variables['foo'];
}

/**
 * Implements hook_theme_suggestions_HOOK_alter().
 */
function test_legacy_theme_theme_suggestions_theme_test_function_suggestions_alter(array &$suggestions, array $variables) {
    // Theme alter hooks run after module alter hooks, so add this theme
    // suggestion to the beginning of the array so that the suggestion added by
    // the theme_suggestions_test module can be picked up when that module is
    // enabled.
    array_unshift($suggestions, 'theme_test_function_suggestions__' . 'theme_override');
}

/**
 * Returns HTML for a theme function suggestion test.
 *
 * Implements the theme_test_function_suggestions__theme_override suggestion.
 */
function test_legacy_theme_theme_test_function_suggestions__theme_override($variables) {
    return 'Theme function overridden based on new theme suggestion provided by the test_legacy_theme theme.';
}

/**
 * Returns HTML for a theme function suggestion test.
 *
 * Implements the theme_test_function_suggestions__module_override suggestion.
 */
function test_legacy_theme_theme_test_function_suggestions__module_override($variables) {
    return 'Theme function overridden based on new theme suggestion provided by a module.';
}

Functions

Title Deprecated Summary
test_legacy_theme_theme_suggestions_theme_test_function_suggestions_alter Implements hook_theme_suggestions_HOOK_alter().
test_legacy_theme_theme_test_function_suggestions__module_override Returns HTML for a theme function suggestion test.
test_legacy_theme_theme_test_function_suggestions__theme_override Returns HTML for a theme function suggestion test.
test_legacy_theme_theme_test_preprocess_suggestions__kitten__meerkat Tests a theme overriding a suggestion of a base theme hook.

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