Ensure that a theme template is tried before getting a non-theme template

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60717 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-08-14 03:57:46 +00:00
parent 50790d8098
commit 3942a9b609

View File

@ -48,6 +48,13 @@ class SSViewer extends Object {
foreach($templateList as $template) {
if(strpos($template,'/') !== false) list($templateFolder, $template) = explode('/', $template, 2);
else $templateFolder = null;
// Use the theme template if available
if(self::$current_theme && isset($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme])) {
if(isset($_GET['debug_request'])) Debug::message("Found template '$template' from main theme '" . self::$current_theme . "': " . var_export($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme], true));
$this->chosenTemplates = array_merge($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme],
$this->chosenTemplates);
}
// Base templates
if(isset($_TEMPLATE_MANIFEST[$template]) && (array_keys($_TEMPLATE_MANIFEST[$template]) != array('themes'))) {
@ -55,13 +62,6 @@ class SSViewer extends Object {
if(isset($_GET['debug_request'])) Debug::message("Found template '$template' from main template archive, containing the following items: " . var_export($_TEMPLATE_MANIFEST[$template], true));
unset($this->chosenTemplates['themes']);
}
// Use the theme template if available
if(self::$current_theme && isset($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme])) {
if(isset($_GET['debug_request'])) Debug::message("Found template '$template' from main theme '" . self::$current_theme . "': " . var_export($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme], true));
$this->chosenTemplates = array_merge($_TEMPLATE_MANIFEST[$template]['themes'][self::$current_theme],
$this->chosenTemplates);
}
if($templateFolder) {
$this->chosenTemplates['main'] = $this->chosenTemplates[$templateFolder];