mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-41604 Moodle should also fallback to the default theme when a parent theme is invalid.
This commit is contained in:
parent
56cc9b387e
commit
b0ec47fb19
@ -451,11 +451,6 @@ class theme_config {
|
||||
include_once($renderersfile);
|
||||
}
|
||||
$this->parent_configs[$parent] = $parent_config;
|
||||
$rendererfile = $parent_config->dir.'/renderers.php';
|
||||
if (is_readable($rendererfile)) {
|
||||
// may contain core and plugin renderers and renderer factory
|
||||
include_once($rendererfile);
|
||||
}
|
||||
}
|
||||
$libfile = $this->dir.'/lib.php';
|
||||
if (is_readable($libfile)) {
|
||||
@ -1420,9 +1415,10 @@ class theme_config {
|
||||
*
|
||||
* @param string $themename
|
||||
* @param stdClass $settings from config_plugins table
|
||||
* @param boolean $parentscheck true to also check the parents. .
|
||||
* @return stdClass The theme configuration
|
||||
*/
|
||||
private static function find_theme_config($themename, $settings) {
|
||||
private static function find_theme_config($themename, $settings, $parentscheck = true) {
|
||||
// We have to use the variable name $THEME (upper case) because that
|
||||
// is what is used in theme config.php files.
|
||||
|
||||
@ -1442,6 +1438,17 @@ class theme_config {
|
||||
if (!is_array($THEME->parents)) {
|
||||
// parents option is mandatory now
|
||||
return null;
|
||||
} else {
|
||||
// We use $parentscheck to only check the direct parents (avoid infinite loop).
|
||||
if ($parentscheck) {
|
||||
// Find all parent theme configs.
|
||||
foreach ($THEME->parents as $parent) {
|
||||
$parentconfig = theme_config::find_theme_config($parent, $settings, false);
|
||||
if (empty($parentconfig)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $THEME;
|
||||
|
Loading…
x
Reference in New Issue
Block a user