WPDK  1.5.0
WordPress Development Kit
 All Data Structures Files Functions Variables Pages
WPDKSubMenu Class Reference
Inheritance diagram for WPDKSubMenu:
WPDKSubMenuDivider

Public Member Functions

 __construct ($parent, $id, $menu_title, $view_controller= '', $capability=self::DEFAULT_CAPABILITY)
 Construct. More...
 
 render ()
 Render. More...
 

Static Public Member Functions

static renderByArray ($sub_menus)
 Render by array. More...
 

Data Fields

const DEFAULT_CAPABILITY = 'read'
 Capability. More...
 
 $capability = self::DEFAULT_CAPABILITY
 
 $hookName = ''
 
 $id = ''
 
 $menuTitle = ''
 
 $pageTitle = ''
 
 $parent = ''
 
 $viewController = ''
 
 $query_args = array()
 Query args. More...
 

Detailed Description

Model for a sub menu

WPDK Sample

Author
=undo= info@.nosp@m.wpxt.nosp@m.re.me
Date
2013-02-26
Version
1.0.1

Definition at line 521 of file wpdk-menu.php.

Constructor & Destructor Documentation

__construct (   $parent,
  $id,
  $menu_title,
  $view_controller = '',
  $capability = self::DEFAULT_CAPABILITY 
)

Construct.

Create an instance of WPDKSubMenu class

Parameters
string | object$parentAny WPDKMenu object or string id of parent
string$idSubmenu unique string id
string$menu_titleThe submenu title
string$view_controllerOptional. Name of view controller or a callback function.
string$capabilityOptional. Minum capabilties to show thhi item. Default WPDKSubMenu::DEFAULT_CAPABILITY
Returns
WPDKSubMenu

Definition at line 562 of file wpdk-menu.php.

Member Function Documentation

render ( )

Render.

Register this sub menu tree to WordPress menu

Definition at line 653 of file wpdk-menu.php.

static renderByArray (   $sub_menus)
static

Render by array.

Return an array of sub menu tems. 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 );
Parameters
array$sub_menusA key value pairs list of sub menus
Returns
array

Definition at line 611 of file wpdk-menu.php.

Field Documentation

$capability = self::DEFAULT_CAPABILITY

Definition at line 530 of file wpdk-menu.php.

$hookName = ''

Definition at line 531 of file wpdk-menu.php.

$id = ''

Definition at line 532 of file wpdk-menu.php.

$menuTitle = ''

Definition at line 533 of file wpdk-menu.php.

$pageTitle = ''

Definition at line 534 of file wpdk-menu.php.

$parent = ''

Definition at line 535 of file wpdk-menu.php.

array $query_args = array()

Query args.

Query args to add to url page

Since
1.3.1

Definition at line 546 of file wpdk-menu.php.

$viewController = ''

Definition at line 536 of file wpdk-menu.php.

const DEFAULT_CAPABILITY = 'read'

Capability.

Default capability

Definition at line 528 of file wpdk-menu.php.


The documentation for this class was generated from the following file: