MDL-21149 preparation for renaming of old standard to standardold

This commit is contained in:
Petr Skoda
2010-01-12 17:21:52 +00:00
parent b1f8c27b60
commit 5f0baa43a5
3 changed files with 14 additions and 4 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ function xmldb_main_install() {
'enrol_plugins_enabled' => 'manual',
'style' => 'default',
'template' => 'default',
'theme' => 'standard', //TODO: MDL-21149 replace with some new default theme when implemented
'theme' => theme_config::DEFAULT_THEME,
'filter_multilang_converted' => 1,
'siteidentifier' => random_string(32).get_host_from_url($CFG->wwwroot),
'backup_version' => 2008111700,
+11 -1
View File
@@ -101,6 +101,12 @@ function theme_get_revision() {
* @since Moodle 2.0
*/
class theme_config {
/**
* @var string default theme, used when requested theme not found
* TODO: MDL-21149 replace with some new default theme when implemented
*/
const DEFAULT_THEME = 'standard';
/**
* You can base your theme on other themes by linking to the other theme as
* parents. This lets you use the CSS and layouts from the other themes
@@ -351,9 +357,13 @@ class theme_config {
if ($config = theme_config::find_theme_config($themename, $settings)) {
return new theme_config($config);
} else if ($themename == theme_config::DEFAULT_THEME) {
throw new coding_exception('Default theme '.theme_config::DEFAULT_THEME.' not available or broken!');
} else {
// bad luck, the requested theme has some problems - admin see details in theme config
return new theme_config(theme_config::find_theme_config('standard', $settings)); // TODO: use some other default MDL-21149
return new theme_config(theme_config::find_theme_config(theme_config::DEFAULT_THEME, $settings));
}
}
+2 -2
View File
@@ -137,7 +137,7 @@ class moodle_page_test extends UnitTestCase {
public function test_cannot_set_course_once_theme_set() {
// Setup fixture
$this->testpage->force_theme('standard');
$this->testpage->force_theme(theme_config::DEFAULT_THEME);
$course = $this->create_a_course();
// Set expectation.
$this->expectException();
@@ -147,7 +147,7 @@ class moodle_page_test extends UnitTestCase {
public function test_cannot_set_category_once_theme_set() {
// Setup fixture
$this->testpage->force_theme('standard');
$this->testpage->force_theme(theme_config::DEFAULT_THEME);
// Set expectation.
$this->expectException();
// Exercise SUT