function drupal_js_defaults

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

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

Parameters

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

See also

hook_js_alter()

File

core/includes/common.inc, line 455

Code

function drupal_js_defaults($data = NULL) {
  return [
    'type' => 'file',
    'group' => JS_DEFAULT,
    'weight' => 0,
    'scope' => 'header',
    'cache' => TRUE,
    'preprocess' => TRUE,
    'attributes' => [],
    'version' => NULL,
    'data' => $data,
    'browsers' => [],
  ];
}

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