You are here

function drupal_js_defaults in Drupal 7

Same name and namespace in other branches
  1. 8 core/includes/common.inc \drupal_js_defaults()
  2. 9 core/includes/common.inc \drupal_js_defaults()

Constructs an array of the defaults that are used for JavaScript items.

Parameters

$data: (optional) The default data parameter for the JavaScript item array.

See also

drupal_get_js()

drupal_add_js()

3 calls to drupal_js_defaults()
AJAXFrameworkTestCase::testLazyLoad in modules/simpletest/tests/ajax.test
Test that new JavaScript and CSS files added during an AJAX request are returned.
drupal_add_js in includes/common.inc
Adds a JavaScript file, setting, or inline code to the page.
locale_js_alter in modules/locale/locale.module
Implements hook_js_alter().

File

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

Code

function drupal_js_defaults($data = NULL) {
  return array(
    'type' => 'file',
    'group' => JS_DEFAULT,
    'every_page' => FALSE,
    'weight' => 0,
    'requires_jquery' => TRUE,
    'scope' => 'header',
    'cache' => TRUE,
    'defer' => FALSE,
    'preprocess' => TRUE,
    'version' => NULL,
    'data' => $data,
  );
}