diff --git a/phpBB/includes/template/twig/loader.php b/phpBB/includes/template/twig/loader.php new file mode 100644 index 0000000000..ec8704e218 --- /dev/null +++ b/phpBB/includes/template/twig/loader.php @@ -0,0 +1,50 @@ +setPaths($paths); + } + + $this->phpbb_locator = $phpbb_locator; + } + + protected function findTemplate($name) + { + $name = (string) $name; + + if (!$name) + { + throw new Twig_Error_Loader(sprintf('Unable to find template "%s".', $name)); + } + + $this->phpbb_locator->set_filenames(array( + 'temp' => $name, + )); + $location = $this->phpbb_locator->get_source_file_for_handle('temp'); + + if (!$location) + { + throw new Twig_Error_Loader(sprintf('Unable to find template "%s".', $name)); + } + + return $this->cache[$name] = $location; + } +} diff --git a/phpBB/includes/template/twig/twig.php b/phpBB/includes/template/twig/twig.php index e12b62be63..77f96e85d0 100644 --- a/phpBB/includes/template/twig/twig.php +++ b/phpBB/includes/template/twig/twig.php @@ -107,7 +107,7 @@ class phpbb_template_twig implements phpbb_template $this->context = $context; $this->extension_manager = $extension_manager; - $loader = new Twig_Loader_Filesystem($phpbb_root_path . 'styles/prosilver/template/'); + $loader = new phpbb_template_twig_loader($phpbb_root_path . 'styles/prosilver/template/', $this->locator); //$loader = new Twig_Loader_Filesystem($phpbb_root_path . 'adm/style/'); $this->twig = new Twig_Environment($loader, array( 'cache' => $phpbb_root_path . 'cache/twig/',