diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-10 13:28:22 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-09-10 13:28:22 +0000 |
commit | af48df1ca52d4dea20eba560dfbc78ee2922e7c9 (patch) | |
tree | 85d3e47b11c35e05a142c1b0dc8d95901eeb1bfa | |
parent | e3daf88ec7a06b2fa1f898a34713993b61b85c96 (diff) | |
download | brdo-af48df1ca52d4dea20eba560dfbc78ee2922e7c9.tar.gz brdo-af48df1ca52d4dea20eba560dfbc78ee2922e7c9.tar.bz2 |
#166681 by dvessel: fix behavior of theme 'override preprocess functions'
-rw-r--r-- | includes/theme.inc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/includes/theme.inc b/includes/theme.inc index 9de016ab3..484e909c4 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -220,6 +220,11 @@ function drupal_rebuild_theme_registry() { * expanded upon; new entries will replace old entries in the * array_merge, but we are careful to ensure some data is carried * forward, such as the arguments a theme hook needs. + * + * An override flag can be set for preprocess functions. When detected the + * cached preprocessors for the hook will not be merged with the newly set. + * This can be useful to themes and theme engines by giving them more control + * over how and when the preprocess functions are run. */ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { $function = $name .'_theme'; @@ -292,7 +297,13 @@ function _theme_process_registry(&$cache, $name, $type, $theme, $path) { } } } - if (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions']) && empty($cache[$hook]['override preprocess functions'])) { + // Check for the override flag and prevent the cached preprocess functions from being used. + // This allows themes or theme engines to remove preprocessors set earlier in the registry build. + if (!empty($info['override preprocess functions'])) { + // Flag not needed inside the registry. + unset($result[$hook]['override preprocess functions']); + } + elseif (isset($cache[$hook]['preprocess functions']) && is_array($cache[$hook]['preprocess functions'])) { $info['preprocess functions'] = array_merge($cache[$hook]['preprocess functions'], $info['preprocess functions']); } $result[$hook]['preprocess functions'] = $info['preprocess functions']; |