So, I really like the feature of Panelizer for "Save as Default" because most sites have more than just "Content Page" as the content type.

However, this lovely charm in panopoly_magic ruins the whole thing:

/**
 * Remove the Save as Default Option
 */
#panels-ipe-edit-control-form #panelizer-save-default {
  display: none;
}

Is there a reason why it's hidden? Or better yet why it's hidden in CSS versus hook_form_panels_ipe_edit_control_form_alter()? Perhaps we put this in code and make it a Panopoly setting to hide this button.

Comments

mcrittenden’s picture

+1 for making this an option. The panopoly_admin settings page seems like a good fit (and I guess panopoly_magic would work too, especially since that's where the CSS currently lives).

dsnopek’s picture

Yeah, I agree, this is a super useful feature and I'd love to get it back. :-)

It was removed from Panopoly in 1.0-rc5. Unfortunately, I haven't been able to track down the issue. Here's the commit that did it:

http://cgit.drupalcode.org/panopoly_magic/commit/?id=7dc1a5e7fd93dfc584a...

However, the issue number in the commit message is wrong. :-/

If anyone can find the original issue, it'd be great to see what the problems were that prompted it's removal!

mglaman’s picture

No idea what this is from, but Google found this: https://drupal.org/files/issues/auto_complete_and-2231879-1.patch & https://drupal.org/files/issues/auto_complete_and-2231879-2.patch

Which led me to: #2231879: Auto complete and throbbers for AJAX elements

So Kalatheme had it originally, looks like maybe ported from there directly into Panopoly?

Bing was useless, as was DuckDuckGo, Google has 4 results with "Remove the Save as Default Option"

mglaman’s picture

Status: Active » Needs review
StatusFileSize
new425 bytes

Well, here's a patch to get it back in, pretty useful piece of Panelizer.

mpotter’s picture

I believe one of the reasons it was removed is because it didn't actually work correctly. Panelizer supports having multiple layouts for a node/content type. This gives a "list" option in Panelizer where you can add different layouts that can be selected for the node.

The "Save as Default" (if I remember correctly) always overwrites the *Default* layout, rather than the layout specifically selected for the node. So using the Save As Default can have huge unintended side-effects of overwriting the default layout, which isn't actually the layout being used/modified on the node.

The same problem actually happens with the "Revert to default" button. It reverts to the default layout, rather than the originally selected layout. But this is less of a problem because it's easy to just edit the node and reset the layout back to the original.

But when Save As Default is used and overwrites the default, there is no way to go back or undo this change. It can essentially break the entire site requiring a database restore. Until this can be fixed in Panelizer, I recommend leaving this button disabled, or at least add an option to Panopoly to hide/show this button, or assign it a different permission.

If this issue has been fixed in Panelizer recently, then let me know and I'll review it.

dsnopek’s picture

Aha, thanks for the insight, Mike!

Even if the problems with Panelizer aren't fixed, we could make this a configurable option because some sites don't use multiple Panelizer defaults, so it's a risk they could choose to take.

But, yeah, ideally, it'd be great if any problems were fixed in Panelizer because this is really cool functionality.

mglaman’s picture

+1 on making it a button. I can see where this can cause headaches -- too bad there isn't page display revisions. Also, if the button is missing and note used some people may forget it exists and try to improve its functionality.

caschbre’s picture

I like the idea of making it a configuration option. Default it to not enabled to avoid folks accidentally using it the wrong way. And then add a big red flashing warning next to the checkbox that enables it describing exactly what it does.

mglaman’s picture

Status: Needs review » Needs work

Given the above statements, moving this to "Needs Work" so we can work on a setting and/or review how this feature is working now.

mglaman’s picture

There is now a patch in the Panelizer queue that fixes the Save Default functionality (at least in my tests.) #2328615: \PanelizerEntityDefault get_default_panelizer_object() method returns null when config exported.

mglaman’s picture

Status: Needs work » Needs review
StatusFileSize
new487 bytes

Here is a Panopoly Core patch to patch Panelizer with fix mentioned in #2328615: \PanelizerEntityDefault get_default_panelizer_object() method returns null when config exported., which should allow us to remove the CSS hiding save default :).

Note: Need both patches in order to test functionality.

mglaman’s picture

Status: Needs review » Needs work

The above patch fixes the fact Save Default wasn't working in 3.1, however realized it doesn't resolve mpotters concern. If the Panelizer is exported to code there is no problem (component can be reverted), however if the Panelizer is not in code it will be forever lost.

damienmckenna’s picture

I've committed mglaman's patch in #2328615: \PanelizerEntityDefault get_default_panelizer_object() method returns null when config exported..

PS, if you uncover other bugs in Panelizer that are affecting Panopoly, please open an issue in Panelizer's queue (maybe tag them "Panopoly" so they can be more easily found?) and I'll work on it.

dsnopek’s picture

Thanks, Damien! We'll try to remember to tag as "Panopoly" in the future. :-)

mglaman’s picture

Referencing #2354437: New revisions should always clone a custom display as this may be a step towards fixing mpotter's concerns.

mglaman’s picture

PI_Ron’s picture

Brilliant. Thanks for this massive usability improvement.