From 2ca39a4720a903c923242ea7061fac0c4c99115d Mon Sep 17 00:00:00 2001
From: Alex Pott <alex.a.pott@googlemail.com>
Date: Wed, 9 Sep 2015 14:28:29 +0100
Subject: [PATCH] Issue #2452475 by lhangea, googletorp, arpitr, neetu morwani,
 ianthomas_uk, Mile23: Remove deprecated function drupal_merge_attached() and
 its references

---
 core/includes/common.inc            | 51 +----------------------------
 core/modules/editor/src/Element.php |  3 +-
 2 files changed, 3 insertions(+), 51 deletions(-)

diff --git a/core/includes/common.inc b/core/includes/common.inc
index 19beefae062a..43c5384e1388 100644
--- a/core/includes/common.inc
+++ b/core/includes/common.inc
@@ -542,55 +542,6 @@ function drupal_js_defaults($data = NULL) {
   );
 }
 
-/**
- * Merges two #attached arrays.
- *
- * The values under the 'drupalSettings' key are merged in a special way, to
- * match the behavior of:
- *
- * @code
- *   jQuery.extend(true, {}, $settings_items[0], $settings_items[1], ...)
- * @endcode
- *
- * This means integer indices are preserved just like string indices are,
- * rather than re-indexed as is common in PHP array merging.
- *
- * Example:
- * @code
- * function module1_page_attachments(&$page) {
- *   $page['a']['#attached']['drupalSettings']['foo'] = ['a', 'b', 'c'];
- * }
- * function module2_page_attachments(&$page) {
- *   $page['#attached']['drupalSettings']['foo'] = ['d'];
- * }
- * // When the page is rendered after the above code, and the browser runs the
- * // resulting <SCRIPT> tags, the value of drupalSettings.foo is
- * // ['d', 'b', 'c'], not ['a', 'b', 'c', 'd'].
- * @endcode
- *
- * By following jQuery.extend() merge logic rather than common PHP array merge
- * logic, the following are ensured:
- * - Attaching JavaScript settings is idempotent: attaching the same settings
- *   twice does not change the output sent to the browser.
- * - If pieces of the page are rendered in separate PHP requests and the
- *   returned settings are merged by JavaScript, the resulting settings are the
- *   same as if rendered in one PHP request and merged by PHP.
- *
- * @param array $a
- *   An #attached array.
- * @param array $b
- *   Another #attached array.
- *
- * @return array
- *   The merged #attached array.
- *
- * @deprecated To be removed in Drupal 8.0.x. Use
- *   \Drupal\Core\Render\BubbleableMetadata::mergeAttachments() instead.
- */
-function drupal_merge_attached(array $a, array $b) {
-  return BubbleableMetadata::mergeAttachments($a, $b);
-}
-
 /**
  * Processes non-asset attachments in a render() structure.
  *
@@ -1057,7 +1008,7 @@ function drupal_pre_render_links($element) {
     }
     // Merge attachments.
     if (isset($child['#attached'])) {
-      $element['#attached'] = drupal_merge_attached($element['#attached'], $child['#attached']);
+      $element['#attached'] = BubbleableMetadata::mergeAttachments($element['#attached'], $child['#attached']);
     }
   }
   return $element;
diff --git a/core/modules/editor/src/Element.php b/core/modules/editor/src/Element.php
index a87f3a0b8bff..43b99bae8203 100644
--- a/core/modules/editor/src/Element.php
+++ b/core/modules/editor/src/Element.php
@@ -10,6 +10,7 @@
 use Drupal\editor\Entity\Editor;
 use Drupal\filter\Entity\FilterFormat;
 use Drupal\Component\Plugin\PluginManagerInterface;
+use Drupal\Core\Render\BubbleableMetadata;
 
 /**
  * Defines a service for Text Editor's render elements.
@@ -93,7 +94,7 @@ function preRenderTextFormat(array $element) {
     $element['#attached']['library'][] = 'editor/drupal.editor';
 
     // Attach attachments for all available editors.
-    $element['#attached'] = drupal_merge_attached($element['#attached'], $this->pluginManager->getAttachments($format_ids));
+    $element['#attached'] = BubbleableMetadata::mergeAttachments($element['#attached'], $this->pluginManager->getAttachments($format_ids));
 
     // Apply XSS filters when editing content if necessary. Some types of text
     // editors cannot guarantee that the end user won't become a victim of XSS.
-- 
GitLab