From b505b5ab65276e36053ef76c81eddc8bfaf61585 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 21 Apr 2003 13:56:09 +0000 Subject: - Committed Gordon's htmlarea patch. --- includes/theme.inc | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'includes') diff --git a/includes/theme.inc b/includes/theme.inc index f4ef6a08c..7013c965d 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -22,7 +22,7 @@ class BaseTheme { $output = "\n"; $output .= "". variable_get(site_name, "drupal") .""; $output .= theme_head($main); - $output .= "background\" text=\"$this->foreground\">"; + $output .= "background\" text=\"$this->foreground". theme_onload_attribute(). "\">"; $output .= "
"; print $output; @@ -77,6 +77,7 @@ class BaseTheme { function footer() { $output = "
"; + $output .= theme_footer(); $output .= ""; print $output; } @@ -141,6 +142,15 @@ function theme_head($main = 0) { return implode($head, "\n"); } +/* + * Execute hook _footer() which is run at the end of the page right before + * the tag + */ +function theme_footer($main = 0) { + $footer = module_invoke_all("footer", $main); + return implode($footer, "\n"); +} + function theme_init() { global $user; @@ -194,4 +204,21 @@ function theme() { } } +/* + * Call _onload hook in all modules to enable modules to insert javascript + * that will get run once the page has been loaded by the browser + */ +function theme_onload_attribute($theme_onloads = array()) { + if (!is_array($theme_onloads)) { + $theme_onloads = array($theme_onloads); + } + // Merge theme onloads (javascript rollovers, image preloads, etc.) + // with module onloads (htmlarea, etc.) + $onloads = array_merge(module_invoke_all("onload"), $theme_onloads); + if (count($onloads)) { + return " onload=\"" . implode("; ", $onloads) . "\""; + } + return; +} + ?> -- cgit v1.2.3