summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnAlbin2008-02-08 23:53:58 (GMT)
committer JohnAlbin2008-02-08 23:53:58 (GMT)
commit5663e4dac584a249050c08adb6f366a9f67cfa39 (patch)
treeb0067f563026ac2d989cef5579e7e34ccece0912
parent2502b3b4e7c09877ad1999770252b9441703f49a (diff)
In template.php, consolidated SUBTHEME_preprocess_HOOK() checks from 4 places to 1 place.
-rw-r--r--template.php48
1 files changed, 12 insertions, 36 deletions
diff --git a/template.php b/template.php
index 9f7c1e1..ae8d627 100644
--- a/template.php
+++ b/template.php
@@ -219,15 +219,6 @@ function _phptemplate_variables($hook, $vars = array()) {
}
$vars['body_classes'] = implode(' ', $body_classes); // implode with spaces
- // Allow a sub-theme to add/alter variables
- if (function_exists($theme_key .'_preprocess_page')) {
- $function = $theme_key .'_preprocess_page';
- $function($vars);
- }
- elseif (function_exists('phptemplate_preprocess_page')) {
- phptemplate_preprocess_page($vars);
- }
-
break;
case 'node':
@@ -255,15 +246,6 @@ function _phptemplate_variables($hook, $vars = array()) {
$node_classes[] = 'node-type-'. $vars['node']->type;
$vars['node_classes'] = implode(' ', $node_classes); // implode with spaces
- // Allow a sub-theme to add/alter variables
- if (function_exists($theme_key .'_preprocess_node')) {
- $function = $theme_key .'_preprocess_node';
- $function($vars);
- }
- elseif (function_exists('phptemplate_preprocess_node')) {
- phptemplate_preprocess_node($vars);
- }
-
break;
case 'comment':
@@ -306,15 +288,6 @@ function _phptemplate_variables($hook, $vars = array()) {
$vars['title'] = '';
}
- // Allow a sub-theme to add/alter variables
- if (function_exists($theme_key .'_preprocess_comment')) {
- $function = $theme_key .'_preprocess_comment';
- $function($vars);
- }
- elseif (function_exists('phptemplate_preprocess_comment')) {
- phptemplate_preprocess_comment($vars);
- }
-
break;
case 'block':
@@ -351,18 +324,21 @@ function _phptemplate_variables($hook, $vars = array()) {
$vars['edit_links'] = '<div class="edit">'. implode(' ', $edit_links) .'</div>';
}
- // Allow a sub-theme to add/alter variables
- if (function_exists($theme_key .'_preprocess_block')) {
- $function = $theme_key .'_preprocess_block';
- $function($vars);
- }
- elseif (function_exists('phptemplate_preprocess_block')) {
- phptemplate_preprocess_block($vars);
- }
-
break;
}
+ // Allow a sub-theme to add or alter variables.
+ $function = $theme_key .'_preprocess_'. $hook;
+ if (function_exists($function)) {
+ $function($vars);
+ }
+ else {
+ $function = 'phptemplate_preprocess_'. $hook;
+ if (function_exists($function)) {
+ $function($vars);
+ }
+ }
+
// The following is a deprecated function included for backwards compatibility
// with Zen 5.x-0.8 and earlier. New sub-themes should not use this function.
if (function_exists('zen_variables')) {