- Patch #160395 by dvessel and merlinofchaos: allow theme engine to register theme variable functions.

6.x
Dries Buytaert 2007-09-01 05:35:15 +00:00
parent 3a7d307845
commit ff61e73a30
1 changed files with 11 additions and 4 deletions

View File

@ -278,6 +278,12 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
} }
} }
// Let the theme engine register theme specific variable functions.
$prefixes[] = $prefix;
if ($type == 'theme_engine') {
$prefixes[] = $theme;
}
foreach ($prefixes as $prefix) {
if (function_exists($prefix .'_preprocess')) { if (function_exists($prefix .'_preprocess')) {
$info['preprocess functions'][] = $prefix .'_preprocess'; $info['preprocess functions'][] = $prefix .'_preprocess';
} }
@ -285,6 +291,7 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) {
$info['preprocess functions'][] = $prefix .'_preprocess_'. $hook; $info['preprocess functions'][] = $prefix .'_preprocess_'. $hook;
} }
} }
}
if (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions']) && empty($cache[$hook]['override preprocess functions'])) { if (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions']) && empty($cache[$hook]['override preprocess functions'])) {
$info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']);
} }