Product SiteDocumentation Site

5.3.2. Menu Items

These events allow new menu items to be inserted in order for new content to be added, such as new pages or integration with other applications.

EVENT_MENU_ACCOUNT (Default)

This event gives plugins the opportunity to add new links to the user account menu available to users from the 'My Account' link on the main menu.

Return Value

  • <Array>: List of HTML links for the user account menu.

EVENT_MENU_DOCS (Default)

This event gives plugins the opportunity to add new links to the documents menu available to users from the 'Docs' link on the main menu.

Return Value

  • <Array>: List of HTML links for the documents menu.

EVENT_MENU_FILTER (Default)

This event gives plugins the opportunity to add new links to the issue list menu available to users from the 'View Issues' link on the main menu.

Return Value

  • <Array>: List of HTML links for the issue list menu.

EVENT_MENU_ISSUE (Default)

This event gives plugins the opportunity to add new links to the issue menu available to users when viewing issues.

Parameters

  • <Integer>: bug ID

Return Value

  • <Array>: List of HTML links for the issue page menu.
    This is an associative array, with the link's label as key and the link target as value, e.g.
    array( plugin_lang_get( 'mypage_label' ) => plugin_page( 'mypage' );
    
    For compatibility with MantisBT versions before 2.21.0, it is also possible to return an array of cooked links :
    array( '<a href="' . plugin_page( 'mypage' ) . '">' . plugin_lang_get( 'mypage_label' ) . '</a>' );
    
    However, this usage is deprecated.

EVENT_MENU_ISSUE_RELATIONSHIP (Default)

This event allows plugins to add new links to the menu under the Relationships section in the View Issue Details page.

Parameters

  • <Integer>: bug ID

Return Value

  • <Array>: List of elements to add to the menu.
    This is an associative array, with the link's label as key and the link target as value, e.g.
    array( plugin_lang_get( 'mypage_label' ) => plugin_page( 'mypage' );
    

EVENT_MENU_MAIN (Default)

This event gives plugins the opportunity to add new menu options to the main menu. New links will be added AFTER the standard menu options.

Return Value

  • <Array>: Hooked events may return an array of menu options. Each array entry will contain an associate array with keys 'title', 'url', 'access_level', and 'icon' (e.g. fa-pencil from Font Awesome).
    return array(
    	array(
    		'title' => 'My Link',
    		'access_level' => DEVELOPER,
    		'url' => 'my_link.php',
    		'icon' => 'fa-random'
    	),
    	array(
    		'title' => 'My Link2',
    		'access_level' => DEVELOPER,
    		'url' => 'my_link2.php',
    		'icon' => 'fa-shield'
    	)
    );
    

EVENT_MENU_MAIN_FRONT (Default)

This event gives plugins the opportunity to add new menu options to main menu. New links will be added BEFORE the standard menu options.

Return Value

  • <Array>: Hooked events may return an array of menu options. Each array entry will contain an associate array with keys 'title', 'url', 'access_level', and 'icon' (e.g. fa-pencil from Font Awesome).
    return array(
    	array(
    		'title' => 'My Link',
    		'access_level' => DEVELOPER,
    		'url' => 'my_link.php',
    		'icon' => 'fa-random'
    	),
    	array(
    		'title' => 'My Link2',
    		'access_level' => DEVELOPER,
    		'url' => 'my_link2.php',
    		'icon' => 'fa-shield'
    	)
    );
    

EVENT_MENU_MAIN_FILTER (Chained)

This event gives plugins the opportunity to modify the complete main menu before it is output (for example re-order items, add items in the middle, remove built-in items, change icons of built-in items).
A single parameter is passed as an array of associate arrays containing the items in the main sidebar menu. The format of this array is the same as EVENT_MENU_MAIN and EVENT_MENU_MAIN_FRONT, and will also contain any entries added as a result of these events.
Plugins should do any modifications needed and return the array back. Returning an empty array will hide the main menu.

Parameters

  • <Array>: menu items

Return Value

  • <Array>: modified menu items

    Note

    When returning the updated menu, the plugin's hook function needs to wrap it in an array, i.e. return array( $p_menu_data ); and not return $p_menu_data;. The reason for this is that the Event API relies on call_user_func_array() to execute callback functions.

EVENT_MENU_MANAGE (Default)

This event gives plugins the opportunity to add new links to the management menu available to site administrators from the 'Manage' link on the main menu. Plugins should try to minimize use of these links to functions dealing with core MantisBT management.

Return Value

  • <Array>: List of HTML links for the management menu.

EVENT_MENU_MANAGE_CONFIG (Default)

This event gives plugins the opportunity to add new links to the configuration management menu available to site administrators from the 'Manage Configuration' link on the standard management menu. Plugins should try to minimize use of these links to functions dealing with core MantisBT configuration.

Return Value

  • <Array>: List of HTML links for the manage configuration menu.

EVENT_MENU_SUMMARY (Default)

This event gives plugins the opportunity to add new links to the summary menu available to users from the 'Summary' link on the main menu.

Return Value

  • <Array>: List of HTML links for the summary menu.