=== modified file 'themes/engines/phptemplate/phptemplate.engine' --- themes/engines/phptemplate/phptemplate.engine 2006-10-23 06:45:17 +0000 +++ themes/engines/phptemplate/phptemplate.engine 2006-11-17 20:28:49 +0000 @@ -24,13 +24,15 @@ function phptemplate_templates($director * An array of regions. The first array element will be used as the default region for themes. */ function phptemplate_regions() { - return array( + $variables['regions'] = array( 'left' => t('left sidebar'), 'right' => t('right sidebar'), 'content' => t('content'), 'header' => t('header'), 'footer' => t('footer') ); + $variables = _phptepmplate_load_variables('regions', $variables); + return $variables; } /** @@ -56,12 +58,7 @@ function _phptemplate_callback($hook, $v global $theme_engine; $variables = array_merge($variables, _phptemplate_default_variables($hook, $variables)); - - // Allow specified variables to be overridden - $variables_function = '_'. $theme_engine .'_variables'; - if (function_exists($variables_function)) { - $variables = array_merge($variables, call_user_func($variables_function, $hook, $variables)); - } + $variables = _phptepmplate_load_variables($hook, $variables); if (is_array($variables['template_files'])) { $suggestions = array_merge($suggestions, $variables['template_files']); @@ -83,6 +80,26 @@ function _phptemplate_callback($hook, $v } /** + * Allow specified variables to be overridden + * + * @param $hook + * The name of the theme function being executed. + * @param $variables + * An associate array of variables passed to be overwritten. + * @return + * An associate array of variables ready to be passed to templates. + */ +function _phptemplate_load_variables($hook, $variables) { + global $theme_engine; + + $variables_function = '_'. $theme_engine .'_variables'; + if (function_exists($variables_function)) { + $variables = array_merge($variables, call_user_func($variables_function, $hook, $variables)); + } + return $variables; +} + +/** * Adds additional helper variables to all templates. * * Counts how many times certain hooks have been called. Sidebar left / right are special cases.