I saw a problem #1822058: Restrict Layouts to Those Set in Panelizer Allowed Layouts come up which looks to be a deeper issue with Panelizer. The problem here is that Panelizer allows a user to "Select Allowed Layout" as part of its "Allowed Content" option per node type, but it doesn't seem to respect those settings when used in the "Change Layout" function of the IPE (doing it on the backend respects the settings). Instead, the IPE uses the global layout settings set at admin/structure/panels/settings/panel-page.

Comments

populist’s picture

I did some more research here and can report the following:

Layouts for the IPE are set in ajax_change_layout() of plugins/display_renderers/panels_renderer_ipe.class.php in the Panels.module. The logic there goes like this:

if (isset($this->display->allowed_layouts)) {
  $layouts = $this->display->allowed_layouts;
}
else {
  $layouts = panels_common_get_allowed_layouts('panels_page');
 }

My guess the problem here is that the $this->display->allowed_layouts's isn't properly getting set in panelizer_panels_cache_get() since a quick look at that logic shows we have explicit handling of the allowed content types, but not the layout.

populist’s picture

Status: Active » Needs review
StatusFileSize
new575 bytes

Here is a patch that likely does the trick. Uses the same pattern as the content types, but adds in the layouts too. It requires you clear your CTools cache to make it work, but I tested it on Panopoly and saw it setting correctly.

merlinofchaos’s picture

Status: Needs review » Fixed

This is a simple fix. Committed and pushed.

damienmckenna’s picture

Version: 7.x-3.x-dev » 7.x-2.x-dev
Status: Fixed » Patch (to be ported)

Should we backport this to v2 too?

tim.plunkett’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev
Status: Patch (to be ported) » Needs review
StatusFileSize
new2.94 KB

I'm seeing the opposite problem. I can open a new issue later, but this touches some of the same code, and seems like just a follow-up.

Basically, the "Use the same allowed layouts as standard Panels pages?" setting is ignored, and all layouts are presented.

ec1ipsis’s picture

I'm seeing the exact same issue mentioned in #5. Will test the patch and report back.

ec1ipsis’s picture

The patch applied cleanly and solves the problem for me using Drupal version 7.22, Panelizer version 7.x-3.1.

damienmckenna’s picture

Issue summary: View changes
StatusFileSize
new2.94 KB

Just a quick reroll.

damienmckenna’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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