Issue #1938948 by Cottser: Temporarily allow PHPTemplate themes to use .html.twig templates during Twig conversion.

8.0.x
catch 2013-03-12 10:45:54 +00:00
parent 0fc4db86b6
commit 332293cd3f
1 changed files with 11 additions and 3 deletions

View File

@ -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';
}