Changing a display's machine name while an attachment exist breaks Views

Created on 30 October 2019, over 4 years ago
Updated 24 May 2024, 23 days ago

If I add an attachment to a display in a view and then change the display's machine name Views breaks all over the place.

You can't:

  • get to the Views overview page.
  • save the view.
  • delete the view.
  • cancel the changes to the view.
  • change the machine name back.
  • relink the attachment to the new display machine name.

I have linked a parent issue which I think is the same thing:

https://www.drupal.org/project/drupal/issues/3035949

--

In my case I found that editing the following allowed me to select a new machine name for the attachment however this probably needs looking at in more depth.

core/modules/views/src/Plugin/views/display/Attachment.php - Line 193

Change:

if ($this->view->displayHandlers->has($display_id) && $this->view->displayHandlers->get($display_id)->acceptAttachments()) {

To:

if ($this->view->displayHandlers->has($display_id) && $this->view->displayHandlers->get($display_id) && $this->view->displayHandlers->get($display_id)->acceptAttachments()) {

Proposed resolution

Update the machine name in all the attachments attached to the display.

🐛 Bug report
Status

Fixed

Version

10.2

Component
Views 

Last updated 1 day ago

Created by

🇦🇺Australia RaphaelBriskie

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024