There's a challenging limitation when using Panels IPE. Many panes render contents based on the current path, which is incorrect when rendering a pane after a Panels IPE action such as adding a pane, updating a pane, or saving IPE.

There are several related issues about this, but I'm starting a new one with a focused approach to work around this limitation.

The basic idea is that when the display is initially rendered with Panels IPE, we should store the current path information in a session variable. Then when later rendering pane content, we can fake $_GET with the path in the session, and finally restore the path after rendering.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelstein created an issue. See original summary.

joelstein’s picture

Status: Active » Needs review
FileSize
1.41 KB

Here's a simple patch which works wonders.

joelstein’s picture

Updated patch to apply cleanly with new Panels release.

A great test case to see this in action is with a Menu Block pane, which if often used to render menu items in a sidebar based on the active menu trail of the current path.

attiks’s picture

Thanks!!!

joelstein’s picture

Here is an improved patch which fakes the path during the entire render phase, not just when the panes are rendered, in case it's needed in any of the Panels render hooks.

joelstein’s picture

Ok, the last patch couldn't work since meta() is called within render(). This moves the fake path business to render_layout(), which is still better than render_pane_content().

stefan.korn’s picture

I can confirm this is working and I have discovered no "side effects" so far.

So +1 for bringing this patch in.

brenda003’s picture

Patch in #6 works great, this was a big problem for us on OG pages not showing all content upon IPE save.

berliner’s picture

I am not entirely sure that I like this approach, but I can confirm too that it is working as advertised. The patch applies properly to Panels 3.9.

stefan.korn’s picture

Patch from #6 might not work if there are broken images in the content that is being rendered within IPE panes (surely, there should be no broken images on a website, but hey this is my not so perfect world ..). This seems to be because the broken image creates an additonal page request and this request might deliver the "fake path", which then does not have the right context for the rendering.

I made an addition to the patch from #6, which tries to directly get a node context from the ajax path and use this as fake path instead of the fake path given with #6. If no node path can be extracted from the ajax path, the faking from #6 will still work as before.

This additional patch will only affect a very specific path, like /panels/ajax/ipe/save_form/panelizer:...
This might surely be improvable, but it does satisfy my current needs.

I am providing the patch (and interdiff with #6) in case someone experiences a similar problem.

xlin’s picture

Update patch from #6 to take into account that user might not have panelizer access to all content types on the site. E.g If user go from node that they can panelizer to a node they can't panelilzer, it will have the wrong context because the $_SESSION['panels_ipe_fake_path'] is still there.