From 4d56ee95e0cf36a1e3b2cb7539fb5fb3899a5837 Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Wed, 28 Apr 2010 03:32:16 +0000 Subject: [PATCH] themes MDL-22223 Added hidefromselector setting for theme. --- lib/outputlib.php | 9 ++++++++- theme/base/config.php | 4 ++++ theme/index.php | 10 +++++----- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/outputlib.php b/lib/outputlib.php index a5668e8ee72..d5c07314253 100644 --- a/lib/outputlib.php +++ b/lib/outputlib.php @@ -323,6 +323,13 @@ class theme_config { */ public $enable_dock = false; + /** + * If set to true then this theme will not be shown in the theme selector unless + * theme designer mode is turned on. + * @var bool + */ + public $hidefromselector = false; + /** * Instance of the renderer_factory implementation * we are using. Implementation detail. @@ -400,7 +407,7 @@ class theme_config { $configurable = array('parents', 'sheets', 'parents_exclude_sheets', 'plugins_exclude_sheets', 'javascripts', 'javascripts_footer', 'parents_exclude_javascripts', 'layouts', 'resource_mp3player_colors', 'enable_dock', - 'filter_mediaplugin_colors', 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow'); + 'filter_mediaplugin_colors', 'rendererfactory', 'csspostprocess', 'editor_sheets', 'rarrow', 'larrow', 'hidefromselector'); foreach ($config as $key=>$value) { if (in_array($key, $configurable)) { diff --git a/theme/base/config.php b/theme/base/config.php index 683fb045303..9bc2e341175 100644 --- a/theme/base/config.php +++ b/theme/base/config.php @@ -141,6 +141,10 @@ $THEME->layouts = array( ), ); +// We don't want the base theme to be shown on the theme selection screen, by setting +// this to true it will only be shown if theme designer mode is switched on. +$THEME->hidefromselector = true; + /** List of javascript files that need to included on each page */ $THEME->javascripts = array(); $THEME->javascripts_footer = array(); diff --git a/theme/index.php b/theme/index.php index 0335be29149..26c81e43923 100644 --- a/theme/index.php +++ b/theme/index.php @@ -70,11 +70,6 @@ $table->head = array(get_string('theme'), get_string('info')); $themes = get_plugin_list('theme'); foreach ($themes as $themename => $themedir) { - - // Skip the base theme unless we are in theme designer mode (they might want to look at it) - if (!$CFG->themedesignermode && $themename == 'base') { - continue; - } // Load the theme config. try { @@ -87,6 +82,11 @@ foreach ($themes as $themename => $themedir) { //obsoleted or broken theme, just skip for now continue; } + if (!$CFG->themedesignermode && $theme->hidefromselector) { + // The theme doesn't want to be shown in the theme selector and as theme + // designer mode is switched off we will respect that decision. + continue; + } // Build the table row, and also a list of items to go in the second cell. $row = array();