function test_theme_preprocess_theme_test_theme_class

Same name in other branches
  1. 8.9.x core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_preprocess_theme_test_theme_class()
  2. 10 core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_preprocess_theme_test_theme_class()
  3. 11.x 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

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

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