Community Documentation

hook_footer

5 core.php hook_footer($main = 0)
6 core.php hook_footer($main = 0)

Insert closing HTML.

This hook enables modules to insert HTML just before the \</body\> closing tag of web pages. This is useful for adding JavaScript code to the footer and for outputting debug information. It is not possible to add JavaScript to the header at this point, and developers wishing to do so should use hook_init() instead.

Parameters

$main: Whether the current page is the front page of the site.

Return value

The HTML to be inserted.

Related topics

File

developer/hooks/core.php, line 696
These are the hooks that are invoked by the Drupal core.

Code

<?php
function hook_footer($main = 0) {
  if (variable_get('dev_query', 0)) {
    return '<div style="clear:both;">' . devel_query_table() . '</div>';
  }
}
?>

Comments

Called from theme_closure

Adding of js setting to header seems possible though...

for Drupal 6 it seems to be possible to manipulate the header JavaScript for passing the Drupal.settings variable in hook_footer(). in other words, drupal_add_js($data = NULL, $type = 'setting') can be used in hook_footer().

For Drupal 7 you can use

For Drupal 7 you can use hook_page_alter: http://preprocess.me/drupal-hookfooter-in-drupal-7

Login or register to post comments