API/functions/bb admin add submenu

From bbPulp

Jump to: navigation, search
Function
bb_admin_add_submenu
File: /bb-admin/admin-functions.php
Class: none
Pluggable: no
Introduced: 1.0alpha - revision 794
Deprecated: no

[edit] Description

void bb_admin_add_submenu ( string $display_name, string $capability, string $file_name[, string $parent = 'plugins.php'] )

Adds a submenu item to the given parent in the administration area. The item appears in the second row of the default layout.

[edit] Parameters

display_name
The text that will display in the menu.
capability
The capability that the viewer must possess to be able to view the menu item.
file_name
The filename of the page being linked to within the /bb-admin directory, or the value to be passed to the "plugin" variable on /bb-admin/admin-base.php. In the latter case, the value is also the name of the function in the plugin that will be automatically called to create the content.
parent
The filename of the parent that this item will display under. Default is 'plugins.php'.

[edit] Examples

Example 1: Add a submenu item to the "Site Management" admin area

bb_admin_add_submenu(__('My plugin'), 'use_keys', 'myplugin_admin_page');

Example 2: Add a submenu item to the "Content" admin area

bb_admin_add_submenu(__('My plugin'), 'use_keys', 'myplugin_admin_page', 'content.php');

Example 3: Add two submenu items to a new menu item

bb_admin_add_menu(__('My plugins'), 'use_keys', 'myplugin_admin_page');
bb_admin_add_submenu(__('My plugin'), 'use_keys', 'myplugin_admin_page', 'myplugin_admin_page');
bb_admin_add_submenu(__('My other plugin'), 'use_keys', 'myotherplugin_admin_page', 'myplugin_admin_page');


Personal tools