theme_onload_attribute

Definition

theme_onload_attribute($theme_onloads = array())
drupal/includes/theme.inc, line 839

Description

Call hook_onload() in all modules to enable modules to insert JavaScript that will get run once the page has been loaded by the browser.

Parameters

$theme_onloads Additional onload directives.

Return value

A string containing the onload attributes.

Related topics

Namesort iconDescription
Themeable functionsFunctions that display HTML, and which can be customized by themes.

Code

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 '';
}