Index: modules/system/system.api.php =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v retrieving revision 1.49 diff -u -r1.49 system.api.php --- modules/system/system.api.php 15 Jul 2009 02:08:41 -0000 1.49 +++ modules/system/system.api.php 15 Jul 2009 09:40:31 -0000 @@ -151,18 +151,36 @@ * to the header at this point, and developers wishing to do so should use * hook_init() instead. * - * @param $main - * Whether the current page is the front page of the site. * @return * The HTML to be inserted. */ -function hook_footer($main = 0) { +function hook_footer() { if (variable_get('dev_query', 0)) { - return '
' . devel_query_table() . '
'; + return array('devel' => array( + '#markup' => '
' . devel_query_table() . '
', + ), + ); } } /** + * Alter closing HTML. + * + * This hook enables modules to alter HTML just before the \ closing + * tag of web pages. This is useful for changing HTML added by other modules + * using hook_footer. + * + * @param $closure + * A renderable array as returned by hook_footer + * @return + * Altered HTML to be inserted. + */ +function hook_footer_alter($closure) { + // Change the css file used to style the toolbar. + $closure['toolbar']['#attached_css'][0] = drupal_get_path('mymodule', '/toolbar.css'); +} + +/** * Perform necessary alterations to the JavaScript before it is presented on * the page. * Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.934 diff -u -r1.934 common.inc --- includes/common.inc 14 Jul 2009 10:22:15 -0000 1.934 +++ includes/common.inc 15 Jul 2009 09:40:28 -0000 @@ -3731,6 +3731,21 @@ } /** + * Execute hook_footer() which is run at the end of the page right before the + * close of the body tag. + * + * @return + * A string containing the results of the hook_footer() calls. + * + * @see hook_footer_alter() + */ +function drupal_render_footer() { + $closure = module_invoke_all('footer'); + drupal_alter('footer', $closure); + return drupal_render($closure); +} + +/** * Renders HTML given a structured array tree. * * Recursively iterates over each of the array elements, generating HTML code. Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.498 diff -u -r1.498 theme.inc --- includes/theme.inc 14 Jul 2009 10:22:17 -0000 1.498 +++ includes/theme.inc 15 Jul 2009 09:40:29 -0000 @@ -1703,20 +1703,6 @@ } /** - * Execute hook_footer() which is run at the end of the page right before the - * close of the body tag. - * - * @param $main (optional) - * Whether the current page is the front page of the site. - * @return - * A string containing the results of the hook_footer() calls. - */ -function theme_closure($main = 0) { - $footer = module_invoke_all('footer', $main); - return implode("\n", $footer) . drupal_get_js('footer'); -} - -/** * Format a username. * * @param $object @@ -1951,7 +1937,7 @@ $variables['rdf_namespaces'] = drupal_get_rdf_namespaces(); $variables['grddl_profile'] = 'http://ns.inria.fr/grddl/rdfa/'; // Closure should be filled last. - $variables['closure'] = theme('closure'); + $variables['closure'] = drupal_render_footer(); if ($node = menu_get_object()) { $variables['node'] = $node;