function drupal_js_defaults

Same name in other branches
  1. 7.x 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 assets.

Parameters

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

Deprecated

in drupal:9.4.0 and is removed from drupal:10.0.0. No direct replacement is provided.

See also

https://www.drupal.org/node/3197679

1 call to drupal_js_defaults()
AttachedAssetsTest::testDeprecatedDrupalJsDefaults in core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
Tests deprecated drupal_js_defaults() function.

File

core/includes/common.inc, line 209

Code

function drupal_js_defaults($data = NULL) {
    @trigger_error('drupal_js_defaults() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. No direct replacement is provided. See https://www.drupal.org/node/3197679', E_USER_DEPRECATED);
    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.