From 332293cd3fe4b159bd0983db06bd5c4ba0977b20 Mon Sep 17 00:00:00 2001 From: catch Date: Tue, 12 Mar 2013 10:45:54 +0000 Subject: [PATCH] Issue #1938948 by Cottser: Temporarily allow PHPTemplate themes to use .html.twig templates during Twig conversion. --- core/includes/theme.inc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 0edb02864b3..1ed2caa386f 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -510,8 +510,8 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { if (!isset($info['path'])) { $result[$hook]['template'] = $path . '/templates/' . $info['template']; } - if ($type == 'module') { - // Add two render engines for modules. + if ($type == 'module' || $type == 'theme_engine') { + // Add two render engines for modules and theme engines. // @todo Remove and make twig the default engine. $render_engines = array( '.html.twig' => 'twig', @@ -663,6 +663,12 @@ function _theme_build_registry($theme, $base_theme, $theme_engine) { _theme_process_registry($cache, $theme_engine, 'theme_engine', $theme->name, dirname($theme->filename)); } + if ($theme_engine == 'phptemplate') { + // Check for Twig templates if this is a PHPTemplate theme. + // @todo Remove this once all core themes are converted to Twig. + _theme_process_registry($cache, 'twig', 'theme_engine', $theme->name, dirname($theme->filename)); + } + // Finally, hooks provided by the theme itself. _theme_process_registry($cache, $theme->name, 'theme', $theme->name, dirname($theme->filename)); @@ -1127,7 +1133,9 @@ function theme($hook, $variables = array()) { $extension = $extension_function(); } } - elseif (isset($info['engine'])) { + // @todo Change this 'if' back to 'elseif' once Twig conversion is + // complete. Normally only modules have this key set. + if (isset($info['engine'])) { if (function_exists($info['engine'] . '_render_template')) { $render_function = $info['engine'] . '_render_template'; }