When a themmer wants to do some pre-render processing on a panel page, the available hooks are on rendering a single pane or the theмming of the whole region. There is no available hook that will provide the panel rendered state before rendering panes and before starting to render regions. I will upload a patch that adds the two described hooks shortly.
Use case:
There is a 3 column panel where the first and last column can be empty, therefore missing. The requirement is to make the middle column span the whole page (understand add appropriate classes), when one of the two, or both of the side columns go missing.
With the solution above, I can hook at the regions pre-render, because I will have the information of the rendered panes, and make the decision how to expand the middle column to a propper size.
Is there a good solution that does not involve JS?
Discarding JS solutions because on slow internet connections, there will be blinking and moving on the page that is not a good option.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | panels-add-pre-render-hooks-for-panes-and-regions-2220271-1.patch | 928 bytes | ndobromirov |
Comments
Comment #1
ndobromirov commentedUpload the patch, please review and give some feedback.
Comment #3
michelleThe patch applies cleanly to the current dev code. I created function test_panels_prerender_regions_alter() and function test_panels_prerender_panes_alter() and they both run as expected. I was able to change the title of a pane by changing it in the alter.
Comment #4
japerrySimple and effective. Committed.
Comment #7
joelstein commentedShould these new hooks be documented in panels.api.php?
Comment #8
ndobromirov commentedIdeally yes :)