Commit 7d706a56 authored by drumm's avatar drumm

#105726 by moshe weitzman. Remove necessity to hard-code theme engine...

#105726 by moshe weitzman. Remove necessity to hard-code theme engine directories since they can change.
parent 3944fe38
......@@ -214,6 +214,21 @@ function path_to_theme() {
return dirname($themes[$theme]->filename);
}
/**
* Return the path to the currently selected engine.
*/
function path_to_engine() {
global $theme, $theme_engine;
if (!isset($theme)) {
init_theme();
}
$engines = list_theme_engines();
return dirname($engines[$theme_engine]->filename);
}
/**
* Retrieve an associative array containing the settings for a theme.
*
......
......@@ -376,12 +376,12 @@ function _phptemplate_default($hook, $variables, $suggestions = array(), $extens
}
else {
if (in_array($hook, array('node', 'block', 'box', 'comment'))) {
$file = "themes/engines/$theme_engine/$hook$extension";
$file = path_to_engine() .'/'. $hook . $extension;
}
else {
$variables['hook'] = $hook;
watchdog('error', t('%engine.engine was instructed to override the %name theme function, but no valid template file was found.', array('%engine' => $theme_engine, '%name' => $hook)));
$file = "themes/engines/$theme_engine/default$extension";
$file = path_to_engine() .'/default'. $extension;
}
}
}
......
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