ThemeSuggestionsTestHooks.php

Namespace

Drupal\theme_suggestions_test\Hook

File

core/modules/system/tests/modules/theme_suggestions_test/src/Hook/ThemeSuggestionsTestHooks.php

View source
<?php

declare (strict_types=1);
namespace Drupal\theme_suggestions_test\Hook;

use Drupal\Core\Hook\Attribute\Hook;

/**
 * Hook implementations for theme_suggestions_test.
 */
class ThemeSuggestionsTestHooks {
    
    /**
     * Implements hook_theme_suggestions_alter().
     */
    public function themeSuggestionsAlter(array &$suggestions, array &$variables, $hook) {
        \Drupal::messenger()->addStatus('theme_suggestions_test_theme_suggestions_alter' . '() executed.');
        if ($hook == 'theme_test_general_suggestions') {
            $suggestions[] = $hook . '__module_override';
            $variables['module_hook'] = 'theme_suggestions_test_theme_suggestions_alter';
        }
    }
    
    /**
     * Implements hook_theme_suggestions_HOOK_alter().
     */
    public function themeSuggestionsThemeTestSuggestionsAlter(array &$suggestions, array $variables) {
        \Drupal::messenger()->addStatus('theme_suggestions_test_theme_suggestions_theme_test_suggestions_alter' . '() executed.');
        $suggestions[] = 'theme_test_suggestions__module_override';
    }
    
    /**
     * Implements hook_theme_suggestions_HOOK_alter().
     */
    public function themeSuggestionsThemeTestSpecificSuggestionsAlter(array &$suggestions, array $variables) {
        $suggestions[] = 'theme_test_specific_suggestions__variant__foo';
    }

}

Classes

Title Deprecated Summary
ThemeSuggestionsTestHooks Hook implementations for theme_suggestions_test.

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