4.6.x common.inc drupal_get_html_head()
4.7.x common.inc drupal_get_html_head()
5.x common.inc drupal_get_html_head()
6.x common.inc drupal_get_html_head()
7.x common.inc drupal_get_html_head()

Retrieves output to be displayed in the HEAD tag of the HTML page.

4 calls to drupal_get_html_head()
DrupalAddFeedTestCase::testBasicFeedAddNoTitle in modules/simpletest/tests/common.test
Test drupal_add_feed() with paths, URLs, and titles.
template_preprocess_book_export_html in modules/book/book.module
Processes variables for book-export-html.tpl.php.
template_process_html in includes/theme.inc
Process variables for html.tpl.php
template_process_maintenance_page in includes/theme.inc
Theme process function for theme_maintenance_field().

File

includes/common.inc, line 352
Common functions that many Drupal modules will need to reference.

Code

function drupal_get_html_head() {
  $elements = drupal_add_html_head();
  drupal_alter('html_head', $elements);
  return drupal_render($elements);
}

Comments

floatingpointmatt’s picture

I'm using hook_theme to set templates for custom pages (pulling data external to Drupal) and though I managed to get templating sorted out, I need to differentiate from page.tpl.php -- but doing so appears to knock out html.tpl.php.

When trying to rebuild the functionality of html.tpl.php, the $head variable seems like it should come from drupal_get_html_head(); however, I lose all the standard CSS and JavaScript includes.

I understand the loss of meta content and shortlink, but I only get meta for Content-Type and Generator and viewport -- nothing else.

The hook_theme override occurs in a module to access the data; however, the template is part of the theme that should contain at least some of the basics.

NOTE: drupal_add_js and drupal_add_css are also not adding to the template head.

Anybody know if this is the expected behaviour, and if not, what might cause this?

floatingpointmatt’s picture

In this case, $styles and $scripts are handled separately.

You'll want drupal_get_css() and drupal_get_js() to round things out.