From 2d52f948c17e64b17f40bacb0f2b4fa40cbca478 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Sat, 1 Jan 2022 14:32:56 +0000 Subject: [PATCH] Issue #3256518 by Spokje: Remove drupal_js_defaults() in D10 instead of D11 --- core/includes/common.inc | 27 ------------------- .../Core/Asset/AttachedAssetsTest.php | 10 ------- 2 files changed, 37 deletions(-) diff --git a/core/includes/common.inc b/core/includes/common.inc index 374a5f6b7d39..8a329484e9fb 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -195,33 +195,6 @@ function base_path() { return $GLOBALS['base_path']; } -/** - * Constructs an array of the defaults that are used for JavaScript assets. - * - * @param $data - * (optional) The default data parameter for the JavaScript asset array. - * - * @deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. No direct - * replacement is provided. - * - * @see https://www.drupal.org/node/3197679 - */ -function drupal_js_defaults($data = NULL) { - @trigger_error('drupal_js_defaults() is deprecated in drupal:9.4.0 and is removed from drupal:11.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' => [], - ]; -} - /** * Assists in attaching the tableDrag JavaScript behavior to a themed table. * diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php index 1687bd2a97bc..54700f93f05e 100644 --- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php +++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php @@ -487,14 +487,4 @@ public function testAddJsFileWithQueryString() { $this->assertStringContainsString('<script src="' . str_replace('&', '&', $this->fileUrlGenerator->generateString('core/modules/system/tests/modules/common_test/querystring.js?arg1=value1&arg2=value2')) . '&' . $query_string . '"></script>', $rendered_js, 'JavaScript file with query string gets version query string correctly appended.'); } - /** - * Tests deprecated drupal_js_defaults() function. - * - * @group legacy - */ - public function testDeprecatedDrupalJsDefaults() { - $this->expectDeprecation('drupal_js_defaults() is deprecated in drupal:9.4.0 and is removed from drupal:11.0.0. No direct replacement is provided. See https://www.drupal.org/node/3197679'); - $this->assertIsArray(drupal_js_defaults()); - } - } -- GitLab