function test_theme_theme_suggestions_alter

Same name and namespace in other branches
  1. 10 core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_theme_suggestions_alter()
  2. 9 core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_theme_suggestions_alter()
  3. 8.9.x core/modules/system/tests/themes/test_theme/test_theme.theme \test_theme_theme_suggestions_alter()

Implements hook_theme_suggestions_alter().

1 string reference to 'test_theme_theme_suggestions_alter'
TestThemeHooks::themeSuggestionsAlter in core/modules/system/tests/themes/test_theme/src/Hook/TestThemeHooks.php
Implements hook_theme_suggestions_alter().

File

core/modules/system/tests/themes/test_theme/test_theme.theme, line 54

Code

function test_theme_theme_suggestions_alter(array &$suggestions, array &$variables, $hook) : void {
  \Drupal::messenger()->addStatus(__FUNCTION__ . '() executed.');
  // 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.
  if ($hook == 'theme_test_general_suggestions') {
    array_unshift($suggestions, 'theme_test_general_suggestions__theme_override');
    $variables['theme_hook'] = 'test_theme_theme_suggestions_alter';
  }
}

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