themes MDL-21984 Removed the need to specify the theme name in layouts within its...
authorSam Hemelryk <sam@moodle.com>
Thu, 15 Apr 2010 06:37:55 +0000 (06:37 +0000)
committerSam Hemelryk <sam@moodle.com>
Thu, 15 Apr 2010 06:37:55 +0000 (06:37 +0000)
lib/outputlib.php
theme/anomaly/config.php
theme/base/config.php
theme/experiment/config.php

index 1f6b16c..018ee9c 100644 (file)
@@ -443,7 +443,7 @@ class theme_config {
             // may contain core and plugin renderers and renderer factory
             include_once($rendererfile);
         }
-
+        
         // cascade all layouts properly
         foreach ($baseconfig->layouts as $layout=>$value) {
             if (!isset($this->layouts[$layout])) {
@@ -1068,14 +1068,21 @@ class theme_config {
 
         $layoutinfo = $this->layout_info_for_page($pagelayout);
         $layoutfile = $layoutinfo['file'];
-        $theme = $layoutinfo['theme'];
-
-        if ($dir = $this->find_theme_location($theme)) {
-            $path = "$dir/layout/$layoutfile";
 
-            // Check the template exists, return general base theme template if not.
-            if (is_readable($path)) {
-                return $path;
+        if (array_key_exists('theme', $layoutinfo)) {
+            $themes = array($layoutinfo['theme']);
+        } else {
+            $themes = array_merge(array($this->name),$this->parents);
+        }
+        
+        foreach ($themes as $theme) {
+            if ($dir = $this->find_theme_location($theme)) {
+                $path = "$dir/layout/$layoutfile";
+
+                // Check the template exists, return general base theme template if not.
+                if (is_readable($path)) {
+                    return $path;
+                }
             }
         }
 
index f5033d2..497b7cf 100644 (file)
@@ -42,82 +42,69 @@ $THEME->editor_sheets = array('styles_tinymce');
 $THEME->layouts = array(
     // Most pages - if we encounter an unknown or a missing page type, this one is used.
     'base' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array()
     ),
     'standard' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     // Course page
     'course' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     // Course page
     'coursecategory' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     'incourse' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     'frontpage' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     'admin' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre'),
         'defaultregion' => 'side-pre'
     ),
     'mydashboard' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     'mypublic' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post'
     ),
     'login' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array()
     ),
     // Pages that appear in pop-up windows - no navigation, no blocks, no header.
     'popup' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
     ),
     // No blocks and minimal footer - used for legacy frame layouts only!
     'frametop' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter', 'noblocks'=>true),
     ),
     // Embeded pages, like iframe embeded in moodleform
     'embedded' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
@@ -126,7 +113,6 @@ $THEME->layouts = array(
     // This must not have any blocks, and it is good idea if it does not have links to
     // other places - for example there should not be a home link in the footer...
     'maintenance' => array(
-        'theme' => 'anomaly',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true, 'noblocks'=>true),
index 48afe4b..4ff7fd4 100644 (file)
@@ -54,55 +54,47 @@ $THEME->editor_sheets = array();
 $THEME->layouts = array(
     // Most backwards compatible layout without the blocks - this is the layout used by default
     'base' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array(),
     ),
     // Standard layout with blocks, this is recommended for most pages with general information
     'standard' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // Main course page
     'course' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
         'options' => array('langmenu'=>true),
     ),
     'coursecategory' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // part of course, typical for modules - default page layout if $cm specified in require_login()
     'incourse' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // The site home page.
     'frontpage' => array(
-        'theme' => 'base',
         'file' => 'frontpage.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // Server administration scripts.
     'admin' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre'),
         'defaultregion' => 'side-pre',
     ),
     // My dashboard page
     'mydashboard' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
@@ -110,13 +102,11 @@ $THEME->layouts = array(
     ),
     // My public page
     'mypublic' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     'login' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('langmenu'=>true),
@@ -124,21 +114,18 @@ $THEME->layouts = array(
 
     // Pages that appear in pop-up windows - no navigation, no blocks, no header.
     'popup' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true),
     ),
     // No blocks and minimal footer - used for legacy frame layouts only!
     'frametop' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true),
     ),
     // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible
     'embedded' => array(
-        'theme' => 'base',
         'file' => 'embedded.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true),
@@ -147,7 +134,6 @@ $THEME->layouts = array(
     // This must not have any blocks, and it is good idea if it does not have links to
     // other places - for example there should not be a home link in the footer...
     'maintenance' => array(
-        'theme' => 'base',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true),
index e0c8fae..783a14a 100644 (file)
@@ -47,89 +47,76 @@ $THEME->editor_sheets = array();
 $THEME->layouts = array(
     // Most backwards compatible layout without the blocks - this is the layout used by default
     'base' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array(),
     ),
     // Standard layout with blocks, this is recommended for most pages with general information
     'standard' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // Main course page
     'course' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
         'options' => array('langmenu'=>true),
     ),
     'coursecategory' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // part of course, typical for modules - default page layout if $cm specified in require_login()
     'incourse' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // The site home page.
     'frontpage' => array(
-        'theme' => 'experiment',
         'file' => 'frontpage.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // Server administration scripts.
     'admin' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre'),
         'defaultregion' => 'side-pre',
     ),
     // My dashboard page
     'mydashboard' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     // My public page
     'mypublic' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array('side-pre', 'side-post'),
         'defaultregion' => 'side-post',
     ),
     'login' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('langmenu'=>true),
     ),
     // Pages that appear in pop-up windows - no navigation, no blocks, no header.
     'popup' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true),
     ),
     // No blocks and minimal footer - used for legacy frame layouts only!
     'frametop' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true),
     ),
     // Embeded pages, like iframe/object embeded in moodleform - it needs as much space as possible
     'embedded' => array(
-        'theme' => 'experiment',
         'file' => 'embedded.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true),
@@ -138,7 +125,6 @@ $THEME->layouts = array(
     // This must not have any blocks, and it is good idea if it does not have links to
     // other places - for example there should not be a home link in the footer...
     'maintenance' => array(
-        'theme' => 'experiment',
         'file' => 'general.php',
         'regions' => array(),
         'options' => array('nofooter'=>true, 'nonavbar'=>true),