When attempting to update the Layout on an existing Page Variant, the value does not seem to stick.
This issue was reported here, but mistakingly attributed to the Page Manager module.
https://www.drupal.org/node/2799019
The issue seems to be that in the form submit handler the setLayout() method is only called when setting the layout for the very first time.
On subsequent updates, the code follows a different path in the logic and setLayout is never called.
I am attaching a patch with the fix I created to get our team unblocked.
Looking at the code though, it looks like a Wizard design pattern is being used to allow for multiple steps, and I'm not sure my solution will integrate with this properly.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | local-env.png | 38.34 KB | yepa |
| #16 | panels-fix_updating_layout-2824632-16-D8.patch | 679 bytes | abramm |
| update_layout_fix.patch | 679 bytes | nplowman |
Comments
Comment #2
sebastien m. commentedComment #3
donaldp commentedI had the same problem in that "Change Layout" was not working. This patch fixes this problem for me.
Comment #4
donaldp commentedThis appears to be a duplicate of: https://www.drupal.org/node/2687483
Comment #5
damienmckennaThis solves the problem for me, though I found I had to click through to the "Content" section before the (custom added) layout settings tab disappeared.
Comment #6
damienmckennaSo I think there should be a follow-up to make sure the correct layout plugin is loaded when the layout is changed.
Comment #7
damienmckennaMarking this a duplicate of #2687483: Cannot switch variant layout.
Comment #8
gianluca.bozzelli commentedsame problem with drupal 7.x and not find fix for my version. Can someone help me? tks.
Comment #9
millionleaves commentedI don't think this is a duplicate of #2687483: Cannot switch variant layout.
I'm running 8.x-4.x-dev from October which has the patch from that issue, but I still can't change the layout of existing variants. Applying the patch from this issue fixed the problem for me on two separate code bases.
Comment #10
anas_maw commentedI can confirm the last patch fixing the issue.
This should be committed
Comment #11
leventdal commentedI still have this on 8.5.3
I am using Panelizer plugin and when I update it is not saved and settings of the columns are reset.
Edit: I guess Update & Save not working.
I tried Change Layout first then Update then the new layout appeared somehow.
Comment #12
hassebasse commentedI still have this problem on
Drupal 8.5.3
Panels 8.x-4.3
Page manager 8.x-4.0-beta3
Havn't the patch been comitted?
Comment #13
hassebasse commentedThe patch work for 8.x-4.3 as well. Installed with good result.
Comment #14
loganphp commentedI had the same problem for Panels 8.x-4.3 with Drupal 8.5.3 in that "Change Layout" was not saving. This patch successfully worked for me.
Comment #15
prexa commentedI was facing the same problem. Patch works fine for Panels 8.x-4.3 with Drupal 8.5.3
Comment #16
abrammI've found this issue by googling the filename of the patch used in my project. The patch is being used for half a year without any issues so +1 RTBC here.
Here's the same patch renamed for better maintainability.
Comment #18
yepaThe patch #16 works fine for 8.x-4.3 on d8.6 as well.
The "Change Layout" feature is back.
Comment #19
yepaAs on my local environment, the test pass without errors on Drupal.org:

I think we need this feature to improve the editors experience ;)
Comment #20
nwom commented#16 worked for me. Thanks!
Comment #21
tresero commented#16 failed. Running php7.2 and postgresql if that matters. Basically it doesn't allow you to edit anymore. The panels variant for example won't open for edit.
Comment #22
nwom commented@tresero: I believe you're encountering another issue at the same time that can be fixed with the following: #2921404: Use context in variant JS to be compatible with BigPipe or by disabling the BigPipe module.
Comment #23
oleksiy#16 solved the issue for me. Thanks!
Comment #25
joelpittetCommitted to the 4.x dev branch, thanks everybody.