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.

Comments

nplowman created an issue. See original summary.

sebastien m.’s picture

Status: Active » Needs review
donaldp’s picture

I had the same problem in that "Change Layout" was not working. This patch fixes this problem for me.

donaldp’s picture

This appears to be a duplicate of: https://www.drupal.org/node/2687483

damienmckenna’s picture

Status: Needs review » Reviewed & tested by the community
Parent issue: » #2809841: Plan for Panels 8.x-3.0-beta6

This 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.

damienmckenna’s picture

So I think there should be a follow-up to make sure the correct layout plugin is loaded when the layout is changed.

damienmckenna’s picture

Status: Reviewed & tested by the community » Closed (duplicate)
Parent issue: #2809841: Plan for Panels 8.x-3.0-beta6 »
Related issues: +#2687483: Cannot switch variant layout

Marking this a duplicate of #2687483: Cannot switch variant layout.

gianluca.bozzelli’s picture

same problem with drupal 7.x and not find fix for my version. Can someone help me? tks.

millionleaves’s picture

Status: Closed (duplicate) » Reviewed & tested by the community

I 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.

anas_maw’s picture

I can confirm the last patch fixing the issue.
This should be committed

leventdal’s picture

I 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.

hassebasse’s picture

I 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?

hassebasse’s picture

The patch work for 8.x-4.3 as well. Installed with good result.

loganphp’s picture

I 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.

prexa’s picture

I was facing the same problem. Patch works fine for Panels 8.x-4.3 with Drupal 8.5.3

abramm’s picture

I'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.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 16: panels-fix_updating_layout-2824632-16-D8.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

yepa’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev

The patch #16 works fine for 8.x-4.3 on d8.6 as well.
The "Change Layout" feature is back.

yepa’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new38.34 KB

As on my local environment, the test pass without errors on Drupal.org:
local test

I think we need this feature to improve the editors experience ;)

nwom’s picture

#16 worked for me. Thanks!

tresero’s picture

#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.

nwom’s picture

@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.

oleksiy’s picture

#16 solved the issue for me. Thanks!

  • joelpittet committed c170bfc on 8.x-4.x authored by nplowman
    Issue #2824632 by nplowman, abramm, yepa, DamienMcKenna, NWOM,...
joelpittet’s picture

Status: Reviewed & tested by the community » Fixed

Committed to the 4.x dev branch, thanks everybody.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.