Created
January 21, 2020 15:21
-
-
Save renebakx/2c8aee12653e730c23fbda3b24bec76d to your computer and use it in GitHub Desktop.
Re-add views theme suggestions for Drupal 8.8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Since the patches/fixes for issues | |
* 2923634 - [PP-1] Use hook_theme_suggestions in views | |
* 2118743 - [PP-3] Twig debug output does not display all suggestions when an array of theme hooks is passed to #theme | |
* | |
* Won't most likely not be in core before D9 lands and frontend developers still rely on those hints being available | |
* in the twig debug. | |
* | |
* You can add this snippet to add them back. | |
* But be carefull, this version doesn't merge or keep the $suggestions other modules or theme might have added! | |
*/ | |
<your_theme>_theme_suggestions_alter(array &$suggestions, array $variables, $hook) | |
{ | |
if (substr_count($hook,'views_',0)){ | |
/** @var \Drupal\views\ViewExecutable $view */ | |
$view = $variables['view']; | |
$suggestions = array_reverse($view->buildThemeFunctions($hook));; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment