diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 1015f67..e91dc29 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -227,6 +227,8 @@ function _theme($hook, $variables = array()) { /** @var \Drupal\Core\Utility\ThemeRegistry $theme_registry */ $theme_registry = \Drupal::service('theme.registry')->getRuntime(); + $theme_hooks = $hook; + // If an array of hook candidates were passed, use the first one that has an // implementation. if (is_array($hook)) { @@ -317,6 +319,9 @@ function _theme($hook, $variables = array()) { if (isset($info['base hook'])) { $suggestions[] = $hook; } + if ($hook != $theme_hooks) { + $suggestions = array_merge($suggestions, (array) $theme_hooks); + } // Invoke hook_theme_suggestions_alter() and // hook_theme_suggestions_HOOK_alter(). diff --git a/core/themes/engines/twig/twig.engine b/core/themes/engines/twig/twig.engine index cd84b33..92912a0 100644 --- a/core/themes/engines/twig/twig.engine +++ b/core/themes/engines/twig/twig.engine @@ -88,6 +88,7 @@ function twig_render_template($template_file, $variables) { $extension = twig_extension(); $current_template = basename($template_file); $suggestions = $variables['theme_hook_suggestions']; + $suggestions = array_unique($suggestions); // Only add the original theme hook if it wasn't a directly called // suggestion. if (strpos($variables['theme_hook_original'], '__') === FALSE) {