function TestDeprecatedSuggestionThemeHooks::themeSuggestionsAlter

Same name and namespace in other branches
  1. main core/modules/system/tests/themes/test_deprecated_suggestion_theme/src/Hook/TestDeprecatedSuggestionThemeHooks.php \Drupal\test_deprecated_suggestion_theme\Hook\TestDeprecatedSuggestionThemeHooks::themeSuggestionsAlter()

Implements hook_theme_suggestions_alter().

Attributes

#[Hook('theme_suggestions_alter')]

File

core/modules/system/tests/themes/test_deprecated_suggestion_theme/src/Hook/TestDeprecatedSuggestionThemeHooks.php, line 17

Class

TestDeprecatedSuggestionThemeHooks
Hook implementations for test_deprecated_suggestion_theme.

Namespace

Drupal\test_deprecated_suggestion_theme\Hook

Code

public function themeSuggestionsAlter(array &$suggestions, array $variables, $hook) : void {
  \Drupal::messenger()->addStatus('test_deprecated_suggestion_theme_theme_suggestions_alter() executed for ' . $hook . '.');
  if ($hook == 'theme_test_suggestion_provided') {
    // Add a deprecated suggestion.
    $suggestions[] = 'theme_test_suggestion_provided__deprecated';
    $suggestions['__DEPRECATED']['theme_test_suggestion_provided__deprecated'] = 'Theme suggestion theme_test_suggestion_provided__deprecated is deprecated in drupal:X.0.0 and is removed from drupal:Y.0.0. This is a test.';
  }
}

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