.../Drupal/Core/Template/ThemeRegistryNodeVisitor.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/core/lib/Drupal/Core/Template/ThemeRegistryNodeVisitor.php b/core/lib/Drupal/Core/Template/ThemeRegistryNodeVisitor.php index 6114392..40ae538 100644 --- a/core/lib/Drupal/Core/Template/ThemeRegistryNodeVisitor.php +++ b/core/lib/Drupal/Core/Template/ThemeRegistryNodeVisitor.php @@ -130,14 +130,14 @@ protected function getReplacementNode(\Twig_Node_Expression_Constant $node, arra /** * Returns candidate templates based on the theme registry. * - * @param string $template_filepath - * The full path relative to the Drupal root for this template. + * @param string $template_filename + * The template file name. * * @return string[] * The candidate templates, including the current template. */ - protected function getCandidateTemplates($template_filepath) { - $template_filename = basename($template_filepath); + protected function getCandidateTemplates($template_filename) { + assert('strpos($template_filename, "/") === FALSE'); $theme_hook = str_replace('.html.twig', '', strtr($template_filename, '-', '_')); $info = $this->themeRegistry->getRuntime()->get($theme_hook); @@ -150,8 +150,8 @@ protected function getCandidateTemplates($template_filepath) { /** * Returns candidate parent templates based on the theme registry. * - * @param string $template_filepath - * The full path relative to the Drupal root for this template. + * @param string $template_filename + * The template file name. * @param string $template_path * The path relative to the Drupal root for the directory that contains this * template. @@ -159,8 +159,9 @@ protected function getCandidateTemplates($template_filepath) { * @return string[]|false * The candidate parent templates, or FALSE when none exist. */ - protected function getCandidateParentTemplates($template_filepath, $template_path) { - $candidates = $this->getCandidateTemplates($template_filepath); + protected function getCandidateParentTemplates($template_filename, $template_path) { + assert('strpos($template_filename, "/") === FALSE'); + $candidates = $this->getCandidateTemplates($template_filename); // The candidates include the current template too, so there must be >=2. if (count($candidates) < 2) {