Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

  • AdminPageFramework
    • AdminPage
    • Factory
    • FieldType
    • MetaBox
    • NetworkAdmin
    • PageMetaBox
    • PostType
    • TaxonomyField
    • Widget

Classes

  • AdminPageFramework
  • AdminPageFramework_Form_Controller
  • AdminPageFramework_Menu_Controller
  • AdminPageFramework_Menu_Model
  • AdminPageFramework_Menu_View
  • AdminPageFramework_Page_Controller
  • AdminPageFramework_Page_Model
  • AdminPageFramework_Page_View

Class AdminPageFramework_Menu_Controller

Provides methods to manipulate menu items.

AdminPageFramework_Factory_Router
Extended by AdminPageFramework_Factory_Model
Extended by AdminPageFramework_Factory_View
Extended by AdminPageFramework_Factory_Controller
Extended by AdminPageFramework_Factory
Extended by AdminPageFramework_Router
Extended by AdminPageFramework_Form_Model_Port
Extended by AdminPageFramework_Form_Model_Validation
Extended by AdminPageFramework_Form_Model
Extended by AdminPageFramework_Form_View
Extended by AdminPageFramework_Form_Controller
Extended by AdminPageFramework_Page_Model
Extended by AdminPageFramework_Page_View_MetaBox
Extended by AdminPageFramework_Page_View
Extended by AdminPageFramework_Page_Controller
Extended by AdminPageFramework_Menu_Model
Extended by AdminPageFramework_Menu_View
Extended by AdminPageFramework_Menu_Controller

Indirect known subclasses

AdminPageFramework, AdminPageFramework_NetworkAdmin

Abstract
Package: AdminPageFramework\AdminPage
Since: 2.0.0
Since: 3.3.1 Changed the name from AdminPageFramework_Menu.
Extends: AdminPageFramework_Menu_View
Located at factory/AdminPageFramework/AdminPageFramework_Menu_Controller.php

Methods summary

public
# setRootMenuPage( string $sRootMenuLabel, string $sIcon16x16 = null, string $iMenuPosition = null )

Sets to which top level page is going to be adding sub-pages.

Example

$this->setRootMenuPage( 'Settings' );
$this->setRootMenuPage(
    'APF Form',
    plugins_url( 'image/screen_icon32x32.jpg', __FILE__ )
);

Parameters

$sRootMenuLabel
string
If the method cannot find the passed string from the following listed items, it will create a top level menu item with the passed string. ( case insensitive )
Dashboard, Posts, Media, Links, Pages, Comments, Appearance, Plugins, Users, Tools, Settings, Network Admin
$sIcon16x16
string
(optional) the source of menu icon with either of the following forms:
  • the URL of the menu icon with the size of 16 by 16 in pixel.
  • the file path of the menu icon with the size of 16 by 16 in pixel.
  • the name of a Dashicons helper class to use a font icon, e.g. dashicons-editor-customchar.
  • the string, 'none', to leave div.wp-menu-image empty so an icon can be added via CSS.
  • a base64-encoded SVG using a data URI, which will be colored to match the color scheme. This should begin with 'data:image/svg+xml;base64,'.
$iMenuPosition
string
(optional) the position number that is passed to the $position parameter of the add_menu_page() function.

Since

2.0.0
2.1.6 The $sIcon16x16 parameter accepts a file path.
3.0.0 The scope was changed to public from protected.

Acecss

public

Remark

Only one root page can be set per one class instance.
public
# setRootMenuPageBySlug( string $sRootMenuSlug )

Sets the top level menu page by page slug.

The page should be already created or scheduled to be created separately.

Example

$this->setRootMenuPageBySlug( 'edit.php?post_type=apf_posts' );

Parameters

$sRootMenuSlug
string
The page slug of the top-level root page.

Since

2.0.0
3.0.0 The scope was changed to public from protected.
public
# addSubMenuItems( array $aSubMenuItem1, array $aSubMenuItem2 = null, array $_and_more = null )

Adds sub-menu items on the left sidebar menu of the administration panel.

It supports pages and links. Each of them has the specific array structure.

Example

$this->addSubMenuItems(
      array(
          'title'         => 'Various Form Fields',
          'page_slug'     => 'first_page',
          'screen_icon'   => 'options-general',
      ),
      array(
          'title'         => 'Manage Options',
          'page_slug'     => 'second_page',
          'screen_icon'   => 'link-manager',
      ),
      array(
          'title'         => 'Google',
          'href'          => 'http://www.google.com',
          'show_page_heading_tab' => false, // this removes the title from the page heading tabs.
      )
);

Parameters

$aSubMenuItem1
array
$aSubMenuItem1 a first sub-menu array. A sub-menu array can be a link or a page. For the specifications of the array structures and its arguments, refer to the parameter section of the addSubMenuItem() method.
$aSubMenuItem2
array
$aSubMenuItem2 (optional) a second sub-menu array.
$_and_more
array
$_and_more (optional) a third and add items as many as necessary with next parameters.

Since

2.0.0
3.0.0 Changed the scope to public.

Remark

The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
Accepts variadic parameters; the number of accepted parameters are not limited to three.
public
# addSubMenuItem( array $aSubMenuItem )

Adds the given sub-menu item on the left sidebar menu of the administration panel.

It supports pages and links. Each of them has the specific array structure.

Example

$this->addSubMenuItem(
      array(
          'title'         => 'Read Me',
          'menu_title'    => 'About'
          'page_slug'     => 'my_plugin_readme',
      )
);

Parameters

$aSubMenuItem
array
a sub-menu array. It can be a page or a link. The array structures are as follows:

Sub-menu Page Array

  • title - (string) the page title of the page.
  • page_slug - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).
  • screen_icon - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below.
    edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic

    ( Notes: the generic icon is available WordPress version 3.5 or above.)

  • capability - (optional, string) the access level to the created admin pages defined here. If not set, the overall capability assigned in the class constructor, which is manage_options by default, will be used.
  • order - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.
  • show_page_heading_tab - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: true.
  • show_in_menu - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.
  • page_title - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.
  • menu_title - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.

Sub-menu Link Array

  • title - (string) the link title.
  • href - (string) the URL of the target link.
  • capability - (optional, string) the access level to show the item, defined here. If not set, the overall capability assigned in the class constructor, which is manage_options by default, will be used.
  • order - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.
  • show_page_heading_tab - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: true.
  • show_in_menu - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.

Since

2.0.0
3.0.0 Changed the scope to public.

Remark

The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.

Methods inherited from AdminPageFramework_Page_Controller

addInPageTab(), addInPageTabs(), setInPageTabTag(), setInPageTabsVisibility(), setPageHeadingTabTag(), setPageHeadingTabsVisibility(), setPageTitleVisibility()

Methods inherited from AdminPageFramework_Page_View_MetaBox

__construct(), _getNumberOfColumns(), _printMetaBox(), _replyToAddMetaboxScript(), _replyToEnableMetaBox(), _replyToReturnDefaultNumberOfScreenColumns(), _replyToSetNumberOfScreenLayoutColumns()

Methods inherited from AdminPageFramework_Form_Controller

addSettingField(), addSettingFields(), addSettingSection(), addSettingSections(), getValue(), removeSettingFields(), removeSettingSections()

Methods inherited from AdminPageFramework_Form_View

_replyToGetFieldOutput(), _replyToGetSectionHeaderOutput()

Methods inherited from AdminPageFramework_Form_Model

_replyToCheckRedirects(), _replyToRegisterSettings(), _replyToSendFormEmail(), getSavedOptions()

Methods inherited from AdminPageFramework_Form_Model_Validation

_handleSubmittedData(), _validateSubmittedData()

Methods inherited from AdminPageFramework_Form_Model_Port

_exportOptions(), _importOptions()

Methods inherited from AdminPageFramework_Router

__call(), _doPageLoadCall(), _isInThePage(), _isInstantiatable(), _sortByOrder()

Methods inherited from AdminPageFramework_Factory_Controller

addHelpText(), hasFieldError(), hasSettingNotice(), setFieldErrors(), setSettingNotice(), setUp()

Methods inherited from AdminPageFramework_Factory_View

_replyToPrintSettingNotice()

Methods inherited from AdminPageFramework_Factory_Model

_getFieldErrors(), _isValidationErrors(), _loadDefaultFieldTypeDefinitions(), _registerFields(), _replyToDeleteFieldErrors(), _replyToSaveFieldErrors(), _replyToSaveNotices(), _setLastInput(), _setUp(), getFieldErrors(), validate()

Methods inherited from AdminPageFramework_Factory_Router

__get(), __toString(), _getFormInstance(), _getHelpPaneInstance(), _getLinkInstancce(), _getPageLoadInfoInstance(), _getResourceInstance(), _replyToLoadComponents()

Magic methods summary

Properties summary

Properties inherited from AdminPageFramework_Form_Model

$_bDoneEmail, $_sFieldsType, $_sTargetPageSlug, $_sTargetSectionTabSlug, $_sTargetTabSlug, $aFieldErrors

Properties inherited from AdminPageFramework_Router

$_aHookPrefixes

Properties inherited from AdminPageFramework_Factory_Router

$oProp

Admin Page Framework Documentation generated by ApiGen 2.8.0