Created
August 17, 2012 21:43
-
-
Save davereid/3382971 to your computer and use it in GitHub Desktop.
Changing layout of panel on the fly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_panels_pre_render(). | |
*/ | |
function custom_panels_pre_render($display, $renderer) { | |
// To switch a panel's layout on the fly, you need to not only set | |
// the display's layout, but also swap out the layout plugin in the | |
// renderer object. | |
ctools_include('plugins', 'panels'); | |
if ($plugin = panels_get_layout($layout)) { | |
$display->layout = $layout; | |
$renderer->plugins['layout'] = $plugin; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment