Posted by devuo on January 27, 2012 at 10:47am
3 followers
Jump to:
| Project: | Panels |
| Version: | 7.x-3.x-dev |
| Component: | Plugins - display renderers |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Currently we only have the possibility to get currently being rendered display, but not the handler. This can be a problem, because there's no simple way to get the handler settings of the handler for example at a content-type plugin render time. This necessity arised while overriding the 'render callback' of 'page_breadcrumb' content-type with the implementation of breadcrumbs in Panels Breadcrumbs. Since 'Panels Breadcrumbs' configuration lies at the handler and there's no access to the handler object at content-type render time, it's impossible to generate a breadcrumb based on user preferences.
| Attachment | Size |
|---|---|
| panels-panels_get_current_page_handler.patch | 1.08 KB |
Comments
#1
See #5 in #1398244: Support the breadcrumb pane for the given example at work.
#2
The information you seek is already available in
page_manager_get_current_page()#3
The problem merlin, is that the static variable in
page_manager_get_current_page()is only set after the content pane has been rendered, and not before.I was fully aware of the existence of this function, and I didn't reference it in the issue because
page_manager_get_current_page()isn't meant to get the just handler, but the whole page (task, subtask, handler, etc.), and it only gets set, as I said, after the page has been rendered.The whole magic happens in
ctools_context_handler_render_handler():panels_panel_context_render()is called.page_manager_get_current_page()is set for the first time.My point is that, the handler is thrown around for quite awhile in the code, even before the display itself is set through
panels_get_current_page_display(), and I believe there's no harm done to let developers have access to the handler beforepage_manager_get_current_page()is set, in order leverage that information at content pane render time.