From 77c94ea5eb07a412ee514388667945432a3a784c Mon Sep 17 00:00:00 2001 From: Fabian Franz Date: Mon, 29 Apr 2019 12:39:19 +0200 Subject: [PATCH] Revert "Issue #3051370 by Pol, Fabianx: Create "scripts" element to align rendering workflow to how "styles" are handled" This reverts commit 5f67268ed94034dbe5df600b6067b1d40e62d73a. --- includes/common.inc | 87 ++++++++++++------------------------ modules/system/system.module | 4 -- 2 files changed, 28 insertions(+), 63 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 01265c6c997f..54ead636a04d 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -4447,48 +4447,12 @@ function drupal_get_js($scope = 'header', $javascript = NULL, $skip_alter = FALS } } - // Sort the JavaScript so that it appears in the correct order. - uasort($items, 'drupal_sort_css_js'); - - // Provide the page with information about the individual JavaScript files - // used, information not otherwise available when aggregation is enabled. - $setting['ajaxPageState']['js'] = array_fill_keys(array_keys($items), 1); - unset($setting['ajaxPageState']['js']['settings']); - drupal_add_js($setting, 'setting'); - - // If we're outputting the header scope, then this might be the final time - // that drupal_get_js() is running, so add the setting to this output as well - // as to the drupal_add_js() cache. If $items['settings'] doesn't exist, it's - // because drupal_get_js() was intentionally passed a $javascript argument - // stripped off settings, potentially in order to override how settings get - // output, so in this case, do not add the setting to this output. - if ($scope == 'header' && isset($items['settings'])) { - $items['settings']['data'][] = $setting; - } - - $elements = array( - '#type' => 'scripts', - '#items' => $items, - ); - - return drupal_render($elements); -} - -/** - * #pre_render callback to add the elements needed for scripts tags to be - * rendered. - * - * @param array $elements - * A render array containing: - * - '#items': The JS items as returned by drupal_add_js() and altered by - * drupal_get_js(). - * - * @return array - * A render array that will render to a string of XHTML "