You are here

function test_theme_preprocess_theme_test_theme_class in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_preprocess_theme_test_theme_class()
  2. 9 core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_preprocess_theme_test_theme_class()

Tests that a class can be loaded within a .theme file.

File

core/modules/system/tests/themes/test_theme/test_theme.theme, line 118
Theme to help test the Twig engine.

Code

function test_theme_preprocess_theme_test_theme_class(&$variables) {
  if (class_exists('\\Drupal\\test_theme\\ThemeClass')) {
    $variables['message'] = 'Loading ThemeClass was successful.';
  }
  else {
    $variables['message'] = 'Loading ThemeClass failed.';
  }
}