From 857aadc16efd66633af3e3ed93e18b44f821ed8d Mon Sep 17 00:00:00 2001
From: quietone <quietone@2572884.no-reply.drupal.org>
Date: Fri, 25 Aug 2023 15:55:19 +1200
Subject: [PATCH] Issue #1977276 by Lendude, tim.plunkett, jofitz, dawehner,
 catch, smustgrave: Get \Drupal\views\Plugin\views\display\Feed::attachTo in
 line with \Drupal\views\Plugin\views\display\DisplayPluginInterface::attachTo

---
 .../views/src/Plugin/views/display/Feed.php    | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/core/modules/views/src/Plugin/views/display/Feed.php b/core/modules/views/src/Plugin/views/display/Feed.php
index f48d61361be9..16d40813005a 100644
--- a/core/modules/views/src/Plugin/views/display/Feed.php
+++ b/core/modules/views/src/Plugin/views/display/Feed.php
@@ -325,7 +325,7 @@ public function submitOptionsForm(&$form, FormStateInterface $form_state) {
   /**
    * {@inheritdoc}
    */
-  public function attachTo(ViewExecutable $clone, $display_id, array &$build) {
+  public function attachTo(ViewExecutable $view, $display_id, array &$build) {
     $displays = $this->getOption('displays');
     if (empty($displays[$display_id])) {
       return;
@@ -333,19 +333,15 @@ public function attachTo(ViewExecutable $clone, $display_id, array &$build) {
 
     // Defer to the feed style; it may put in meta information, and/or
     // attach a feed icon.
-    $clone->setArguments($this->view->args);
-    $clone->setDisplay($this->display['id']);
-    $clone->buildTitle();
-    if ($plugin = $clone->display_handler->getPlugin('style')) {
-      $plugin->attachTo($build, $display_id, $clone->getUrl(), $clone->getTitle());
-      foreach ($clone->feedIcons as $feed_icon) {
+    $view->setArguments($this->view->args);
+    $view->setDisplay($this->display['id']);
+    $view->buildTitle();
+    if ($plugin = $view->display_handler->getPlugin('style')) {
+      $plugin->attachTo($build, $display_id, $view->getUrl(), $view->getTitle());
+      foreach ($view->feedIcons as $feed_icon) {
         $this->view->feedIcons[] = $feed_icon;
       }
     }
-
-    // Clean up.
-    $clone->destroy();
-    unset($clone);
   }
 
   /**
-- 
GitLab