Updated: Comment #0
Problem/Motivation
When a theme suggestion is called directly, like theme('comment__node_article', …)
, the Twig debug output does not show the base template - in this case comment.html.twig.
Proposed resolution
In theme(), add a 'base hook' key to the $variables array when needed. Have the Twig debug code look for this key and append it to the theme suggestion debug information if found.
Remaining tasks
Write tests.
User interface changes
Twig debug output will display the base template when theme suggestions are called directly.
API changes
No user-facing API changes. A new key will sometimes be available in the $variables array, this may or may not be useful to themers and module developers.
Related Issues
#1751194: Introduce hook_theme_suggestions_alter() and hook_theme_suggestions_HOOK_alter()