The objects of class panels_display are reusable, so their configuration (including context) may be changed many times during panel rendering, so I suggest to store display context data in renderer and pass renderer object to pane and region theme functions. The patch is attached.

Description of the problem.
Using panelizer and views, create a panel which contains the same panels with other contexts. In panels_display::render(), $renderer->display->context will be different in hook_panels_pre_render() and hook_panels_post_render(). The problem appears in https://drupal.org/project/panels_style_collapsible module which tries to construct region title from display context and gets the incorrect context (see #2218489: Incorrect use of display context in region render theme).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

maximpodorov’s picture

Status: Active » Needs review
FileSize
2.36 KB
maximpodorov’s picture

Issue summary: View changes
maximpodorov’s picture

Please review this patch for committing. Current Panels behavior is not correct in this sense.

andypost’s picture

+++ b/plugins/display_renderers/panels_renderer_standard.class.php
@@ -166,6 +177,7 @@ class panels_renderer_standard {
     $this->display = &$display;
+    $this->display_context = $display->context;

Maybe better implement a $display->original_context variable to store initial

maximpodorov’s picture

Why?

maximpodorov’s picture

Unfortunately, no one reviews this patch. Maybe I'm the only person who suffer this problem since it breaks recursive panels only. But I suggest to add this fix to the next Panels release.

ddrozdik’s picture

Hi Maxim,

Please re-roll this patch, and I will review it. And provide steps for reproduce bug described by you.