Hi everybody,
Is there any way to send an argument or define a context when embedding a view in mega menu?
Thank you,
Damien.
No Universal solution fits all special business requirements. Our experienced team is ready with ideas and state-of-the-art technical solutions to consult the best solution within your budget.
Ok i manged to do it, it's a quick patch so needs to be upgraded and enhanced!
1 - In /templates/admin/megamenu_item_admin.tpl.php change the line 6 to
block_id;?>" type="text" class="setting" value="type=block&title=<?php print $item->title;?>&argument=<?php print $item->argument; ?>&block_id=<?php print $item->block_id;?>&block_module=<?php print $item->block_module;?>" />
2- in /templates/meun/theme.inc, replace:
$block_content = module_invoke($block->block_module, 'block_view', $block->block_id);
to
if($block->block_module=='views'){
$viewParams = explode('-', $block->block_id);
$arguments = explode(',', $block->argument);
$view = views_get_view($viewParams[0]);
$block_content['content'] = $view->preview($viewParams[1],$arguments);
}else{
$block_content = module_invoke($block->block_module, 'block_view', $block->block_id);
}
3- then change the argument parameter in text input field on tab edit item (paramater argument), you can use multiple arguments using , (4,2..)
Thank you. This is great!