Hello Everyone,
I'm at my wits end here. I've had good luck developing several plugins now and I'm getting pretty familiar with the process. I want to do up a small plugin that creates a new menu block called 'Help' and I do not want to do this using Advanced Menu Manager (which doesn't seem to work with Bootstrap Darkroom anyway).
I need the php for this process. It looks to me like the thing to do is register the new block and then apply it on the blockmanager_apply event, but this is not working.
I've emulated this process after studying the Additional Pages plugin, but I can't get it to work. Here's what I have so far, any help is appreciated:
QUICK SIDE NOTE: This is commented out because it causes an error 500 from my web server. Not sure what that's about. //$menu->apply('MENUBAR', 'menubar_welcome.tpl' );
Here's what I have; thanks in advance:
function register_default_menubar_blocks2($menu_ref_arr)
{
$menu = & $menu_ref_arr[0];
if ($menu->get_id() != 'menubar')
return;
$menu->register_block( new RegisteredBlock( 'mbWelcome', 'Welcome', 'piwigo'));
}
include_once(PHPWG_ROOT_PATH.'include/block.class.php');
/**
* Setups each block the main menubar.
*/
function initialize_menu2()
{
//global $page, $conf, $user, $template, $filter;
$menu = new BlockManager("menubar");
$menu->load_registered_blocks();
$menu->prepare_display();
if ( ($block=$menu->get_block('mbWelcome')) != null )
{
// about link
$block->data['about'] =
array(
'TITLE' => l10n('About Piwigo'),
'NAME' => l10n('About'),
'URL' => get_root_url().'about.php',
);
$block->template = 'menubar_welcome.tpl';
}
//--------------------------------------------------------------- identification
//$menu->apply('MENUBAR', 'menubar_welcome.tpl' );
}
add_event_handler('blockmanager_register_blocks', 'register_default_menubar_blocks2');
add_event_handler('blockmanager_apply', 'initialize_menu2');
Offline