diff --git a/core/includes/common.inc b/core/includes/common.inc index 8357938..880d7f8 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -541,22 +541,8 @@ function drupal_merge_attached(array $a, array $b) { * When attaching something of a non-existing attachment type. */ function drupal_process_attached(array $elements) { - // If there is something to set, we should set it. - if (!empty($elements['#attached'])) { - // We merge the attachments with a static on - // HtmlResponseAttachmentsProcessor. If that property is empty, we have to - // set it first. - if (empty(HtmlResponseAttachmentsProcessor::$legacyAttached)) { - HtmlResponseAttachmentsProcessor::$legacyAttached = $elements['#attached']; - } - else { - HtmlResponseAttachmentsProcessor::$legacyAttached = - BubbleableMetadata::mergeAttachments( - HtmlResponseAttachmentsProcessor::$legacyAttached, - $elements['#attached'] - ); - } - } + $build['#attached'] = $elements['#attached']; + \Drupal::service('renderer')->render($build); } /** diff --git a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php index 0b001c7..6104b0a 100644 --- a/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php +++ b/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php @@ -37,15 +37,6 @@ class HtmlResponseAttachmentsProcessor implements AttachmentsResponseProcessorInterface { /** - * An ['#attached'] array. - * - * Provided so that we can support drupal_processed_attached() as an API. - * - * @var array - */ - public static $legacyAttached; - - /** * The asset resolver service. * * @var \Drupal\Core\Asset\AssetResolverInterface @@ -148,10 +139,6 @@ public function processAttachments(AttachmentsInterface $response) { return $e->getResponse(); } - // Add the static attachment array to preserve drupal_process_attached(). - if (!empty(static::$legacyAttached)) { - $response->addAttachments(static::$legacyAttached); - } // Get a reference to the attachments. $attached = $response->getAttachments();