Created
July 9, 2012 12:12
-
-
Save dimatter/3076130 to your computer and use it in GitHub Desktop.
Render a mini panel, with a node argument given in an improper way.
This file contains hidden or 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
/** | |
* Render a mini panel, with a node argument given in an improper way. | |
*/ | |
function _render_mini_panel($mini_panel_id, $node = null) | |
{ | |
$output = ""; | |
$panel_mini = panels_mini_load($mini_panel_id); | |
if($panel_mini) { | |
//Add the node arguments in a improper location | |
if($node) { | |
foreach($panel_mini->display->content as $id => $data) { | |
$panel_mini->display->content[$id]->configuration['improper_args']['node'] = $node; | |
} | |
} | |
//Whatever that means | |
ctools_include('context'); | |
$panel_mini->context = $panel_mini->display->context = ctools_context_load_contexts($panel_mini); | |
//Render it | |
$output = panels_render_display($panel_mini->display); | |
} | |
return $output; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment