function drupal_js_defaults

Same name in other branches
  1. 9 core/includes/common.inc \drupal_js_defaults()
  2. 8.9.x 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 4442

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,
    );
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.