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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ndobromirov’s picture

Assigned: ndobromirov » Unassigned
Status: Active » Needs review
FileSize
928 bytes

Upload the patch, please review and give some feedback.

Michelle’s picture

Status: Needs review » Reviewed & tested by the community

The 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.

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Simple and effective. Committed.

  • japerry committed 2ee73fb on 7.x-3.x authored by ndobromirov
    Issue #2220271 by ndobromirov: Add pre-render hooks before rendering all...

Status: Fixed » Closed (fixed)

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

joelstein’s picture

Should these new hooks be documented in panels.api.php?

ndobromirov’s picture

Ideally yes :)