diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-07-03 18:48:41 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-07-03 18:48:41 +0000 |
commit | 435f3154f9c347f35a4685d6456b9aded4171bc2 (patch) | |
tree | 2b12de72d697709b9904765313a242e1a71ba162 /themes | |
parent | b5cdf535f4a233cd4156e6c091e6aa1f3f28800a (diff) | |
download | brdo-435f3154f9c347f35a4685d6456b9aded4171bc2.tar.gz brdo-435f3154f9c347f35a4685d6456b9aded4171bc2.tar.bz2 |
- Patch #141730 by Earl: allow theming system to use wildcards. I promised in the issue that this patch would still go in, so here goes.
Diffstat (limited to 'themes')
-rw-r--r-- | themes/chameleon/chameleon.theme | 11 | ||||
-rw-r--r-- | themes/engines/phptemplate/phptemplate.engine | 32 |
2 files changed, 3 insertions, 40 deletions
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index 7433ed8ef..7ba6d71f8 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -10,16 +10,7 @@ * Implementation of hook_theme. Auto-discover theme functions. */ function chameleon_theme($existing, $type, $theme, $path) { - $templates = array(); - // Check for function overrides. - foreach ($existing as $hook => $info) { - if (function_exists($theme .'_'. $hook)) { - $templates[$hook] = array( - 'function' => $theme .'_'. $hook, - ); - } - } - return $templates; + return drupal_find_theme_functions($existing, array($theme)); } function chameleon_page($content, $show_blocks = TRUE, $show_messages = TRUE) { diff --git a/themes/engines/phptemplate/phptemplate.engine b/themes/engines/phptemplate/phptemplate.engine index 4e9c065af..48f620838 100644 --- a/themes/engines/phptemplate/phptemplate.engine +++ b/themes/engines/phptemplate/phptemplate.engine @@ -20,36 +20,8 @@ function phptemplate_init($template) { * we need to. */ function phptemplate_theme($existing, $type, $theme, $path) { - $templates = array(); - - // Check for template overrides. - $files = drupal_system_listing('\.tpl\.php$', $path, 'name', 0); - - foreach ($files as $template => $file) { - // chop off the .tpl - $template = substr($template, 0, -4); - if (isset($existing[$template])) { - $templates[$template] = array( - 'file' => $template, - 'path' => dirname($file->filename), - ); - } - } - - // Check for function overrides. - foreach ($existing as $hook => $info) { - if (function_exists($theme .'_'. $hook)) { - $templates[$hook] = array( - 'function' => $theme .'_'. $hook, - ); - } - else if (function_exists('phptemplate_'. $hook)) { - $templates[$hook] = array( - 'function' => 'phptemplate_'. $hook, - ); - } - } - + $templates = drupal_find_theme_functions($existing, array('phptemplate', $theme)); + $templates += drupal_find_theme_templates($existing, '.tpl.php', $path); return $templates; } |