Commit 7a88330d authored by Dries's avatar Dries

- Committed slightly modified version of Kjartan's theme.inc patch: Drupal
  will now barf when trying to instantiate a non-existing theme class.
  This should help to identify broken themes, and to track down theme system
  related bugs.
parent 4079abab
......@@ -116,9 +116,13 @@ function theme_error($message) {
return "<div style=\"color: red;\">$message</div>";
}
function theme_list() {
function theme_list($refresh = 0) {
static $list;
if ($refresh) {
unset($list);
}
if (!$list) {
$list = array();
$result = db_query("SELECT * FROM system where type = 'theme' AND status = '1' ORDER BY name");
......@@ -142,16 +146,18 @@ function theme_init() {
$themes = theme_list();
$name = $user->theme ? $user->theme : variable_get("theme_default", 0);
if (is_object($themes[$name])) {
include_once($themes[$name]->filename);
$theme_class = "Theme_$name";
@$obj =& new $theme_class();
$obj->path = dirname($themes[$name]->filename);
return $obj;
$class = "Theme_$name";
$instance =& new $class();
$instance->path = dirname($themes[$name]->filename);
}
else {
$instance =& new BaseTheme;
}
@$obj =& new BaseTheme;
return $obj;
return $instance;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment