Hello,

I already found #551144: Mini-Panels : how to render a mini-panel directly in code? about simple mini-panel rendering, but I need to pass arguments to the mini-panel.
How could I render a mini-panel with arguments?

Thanks in advance.

Comments

delykj’s picture

Status: Active » Needs review

Here is a simple solution:

<?php
	//load CTools and Panels stuff
	ctools_include('context');
	panels_load_include('panels_mini', 'panels_mini/plugins/content_types/');
	
	$conf = array();
	$conf['override_title'] = 0;
	$conf['override_title_text'] = '';
	$context = null;

	//your arguments
	$panel_args = array();	  
	$panel_args[0] = 'myparameter1';	
	$panel_args[] = 'myparameter2';	
	
	//Mini-panel name
	$minipanel_name = 'taxonomy_media_mp';
	
	//render the mini panel
	$output = panels_mini_panels_mini_content_type_render($minipanel_name, $conf, $panel_args, $context);
	
	print $output->content; 
?>
merlinofchaos’s picture

Status: Needs review » Fixed

Not really a patch that needs review. Though...possibly having an easier API to do this might be handy, I suppose.

Althought ctools_content_render() might be the preferable function to render a mini panel.

Status: Fixed » Closed (fixed)

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