Currently, in the Drupal 8 port, you can choose the layout when creating a new variant, but can't change the layout after the fact.

In the end, we should provide a UI similar to Drupal 7 which allows you to choose a new layout and then map the regions from the old layout to the new.

However, that will be much easier after we finish #2550879: Use CTools Wizard API to add/edit Pages (and move plugin UI using PluginWizardInterface).

For the time being we just need any UI that will work! This could move all the blocks that are on regions that no longer exist to the first region (or last region?), and leave blocks alone that are on region names that also exist in the new layout. This is not ideal, but it would at minimum allow changing layouts...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dsnopek created an issue. See original summary.

swentel’s picture

dsnopek’s picture

Yeah, if that issue lands than this will be implemented as a "Layout" wizard step. If that issue doesn't land... I'm not sure how we'd implement, but it'll be harder than if it does land. :-)

dsnopek’s picture

Title: Provide UI for changing the layout » Provide simple UI for changing the layout
Issue summary: View changes

Now that #2550879: Use CTools Wizard API to add/edit Pages (and move plugin UI using PluginWizardInterface) is postponed to "Milestone 2", I'm going to re-scope this issue to just building any UI that can work, rather than trying to replicate the D7 UI or making the "ideal UI".

phenaproxima’s picture

FileSize
5.14 KB

Here's as far as I got with this patch. This adds the widget (UI element), but does not have any backend logic to actually save the blocks' configuration. Because, as @dsnopek and I discussed on IRC, it would conflict with Page Manager.

dsnopek’s picture

Status: Active » Needs review
FileSize
5.35 KB

@phenaproxima's UI and the 'map' element are super cool!

However, I spent a bunch of time trying to get this to work and couldn't due to the fact that page_manager is providing the block placement UI, and updating the block configuration AFTER our submitConfigurationForm() is run. I tried adding an additional #submit callback, and just couldn't come up with anything that would work.

The only thing I could come up with was updating the block placement in setConfiguration(), however, this is already after the form has been submitted and it would be crazy hacky to pass in the mapping information here (since it isn't actually valid configuration).

So, I simplified the patch greatly, and made the setConfiguration() look for blocks placed in invalid regions and set them to the first valid region. Even though this is a hack, it can be justified as simply making invalid configuration valid, so it's a little less icky.

Status: Needs review » Needs work

The last submitted patch, 6: panels-simple-layout-ui-2558575-6.patch, failed testing.

dsnopek’s picture

Status: Needs work » Needs review
FileSize
5.35 KB
834 bytes

This should fix the strict PHP warning that the testbot is complaining about!

samuel.mortenson’s picture

Status: Needs review » Needs work

Found a small bug:

  1. Download and enable Display Suite.
  2. Set your panels display to use the built in "Single Column", save.
  3. Go back to editing your display and switch the layout to Display Suite -> Two column layout.
  4. Open Layout Settings -> Custom Wrappers, and change any setting.
  5. Save, go back to your display, open Layout Settings -> Custom Wrappers, confirm that the setting is not set.

Settings are set correctly if you were previously using a Display Suite layout then decide to switch to another Display Suite layout, probably because the original form was built with the correct elements.

dsnopek’s picture

Status: Needs work » Needs review
FileSize
6.95 KB
1.85 KB

Amazing catch, Sam, thanks!

Here's a patch that fixes this issue in my testing. Please let me know if it works for you!

samuel.mortenson’s picture

That fixes my original problem, nice job!

japerry’s picture

Status: Needs review » Reviewed & tested by the community

Seems like the only issues I could find are related to page manager itself. It seems like the patch in #10 does allow for basic layout switching.

  • japerry committed cc0f39c on 8.x-3.x authored by dsnopek
    Issue #2558575 by dsnopek, phenaproxima, samuel.mortenson, japerry:...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

woot, fixed.

Status: Fixed » Closed (fixed)

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