PHP Class WPDKSubMenu

## WPDK Sample * https://github.com/wpXtreme/wpdk-sample-menu
Author: =undo= ([email protected])
ファイルを表示 Open project: wpxtreme/wpdk Class Usage Examples

Public Properties

Property Type Description
$capability
$hookName
$id
$menuTitle
$pageTitle
$parent
$query_args array Query args to add to url page
$viewController

Public Methods

Method Description
__construct ( string | object $parent, string $id, string $menu_title, string $view_controller = '', string $capability = self::DEFAULT_CAPABILITY ) : WPDKSubMenu Create an instance of WPDKSubMenu class
render ( ) Register this sub menu tree to WordPress menu
renderByArray ( array $sub_menus ) : array Return an array of sub menu tems.

Method Details

__construct() public method

Create an instance of WPDKSubMenu class
public __construct ( string | object $parent, string $id, string $menu_title, string $view_controller = '', string $capability = self::DEFAULT_CAPABILITY ) : WPDKSubMenu
$parent string | object Any WPDKMenu object or string id of parent
$id string Submenu unique string id
$menu_title string The submenu title
$view_controller string Optional. Name of view controller or a callback function.
$capability string Optional. Minum capabilties to show thhi item. Default WPDKSubMenu::DEFAULT_CAPABILITY
return WPDKSubMenu

render() public method

Register this sub menu tree to WordPress menu
public render ( )

renderByArray() public static method

Render a list of sub menu from any top level menu. Useful to add sub menus to Custom Post Type top level menu or to any WordPress top level menu ## Example $sub_menus = array( 'edit.php?post_type=' . WPXMailManagerCustomPostType::ID => array( WPDKSubMenuDivider::DIVIDER, array( 'menuTitle' => __( 'Settings', WPXMAILMANAGER_TEXTDOMAIN ), 'capability' => self::MENU_CAPABILITY, 'viewController' => 'WPXMailManagerConfigurationViewController' ), WPDKSubMenuDivider::DIVIDER, array( 'menuTitle' => __( 'About', WPXMAILMANAGER_TEXTDOMAIN ), 'capability' => self::MENU_CAPABILITY, 'viewController' => 'WPXMailManagerConfigurationViewController' ), ) ); WPDKSubMenu::renderByArray( $sub_menus );
public static renderByArray ( array $sub_menus ) : array
$sub_menus array A key value pairs list of sub menus
return array

Property Details

$capability public_oe property

public $capability

$hookName public_oe property

public $hookName

$id public_oe property

public $id

$menuTitle public_oe property

public $menuTitle

$pageTitle public_oe property

public $pageTitle

$parent public_oe property

public $parent

$query_args public_oe property

Query args to add to url page
Since: 1.3.1
public array $query_args
return array

$viewController public_oe property

public $viewController