$oScreen
$oScreen : object
Stores the screen object.
Provides methods to manipulate menu items.
finalizeInPageTabs() : void
Finalizes the in-page tab property array.
This finalizes the added in-page tabs and sets the default in-page tab for each page. Also this sorts the in-page tab property array. This must be done before registering settings sections because the default tab needs to be determined in the process.
setRootMenuPage(string $strRootMenuLabel, string $strURLIcon16x16, string $intMenuPosition) : void
Sets to which top level page is going to be adding sub-pages.
$this->setRootMenuPage( 'Settings' );
$this->setRootMenuPage(
'APF Form',
plugins_url( 'image/screen_icon32x32.jpg', FILE )
);
string | $strRootMenuLabel | 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 |
string | $strURLIcon16x16 | ( optional ) the URL or the file path of the menu icon. The size should be 16 by 16 in pixel. |
string | $intMenuPosition | ( optional ) the position number that is passed to the $position parameter of the add_menu_page() function. |
setRootMenuPageBySlug(string $strRootMenuSlug) : void
Sets the top level menu page by page slug.
The page should be already created or scheduled to be created separately.
$this->setRootMenuPageBySlug( 'edit.php?post_type=apf_posts' );
string | $strRootMenuSlug | The page slug of the top-level root page. |
addSubMenuPage(string $strPageTitle, string $strPageSlug, string $strScreenIcon, string $strCapability, integer $numOrder, boolean $fShowPageHeadingTab, boolean $fShowInMenu) : void
Adds a single sub-menu page.
$this->addSubMenuPage( 'My Page', 'my_page', 'edit-pages' );
string | $strPageTitle | The title of the page. |
string | $strPageSlug | The slug of the page. |
string | $strScreenIcon | ( optional ) Either a screen icon ID, a url of the icon, or a file path to the icon, with the size of 32 by 32 in pixel. The accepted icon IDs are as follows. 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 Note: the generic ID is available since WordPress 3.5. |
string | $strCapability | ( optional ) The access level to the page. |
integer | $numOrder | ( optional ) the order number of the page. The lager the number is, the lower the position it is placed in the menu. |
boolean | $fShowPageHeadingTab | ( optional ) If this is set to false, the page title won't be displayed in the page heading tab. Default: true. |
boolean | $fShowInMenu | ( 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. |
showPageHeadingTabs(boolean $fShow, string $strPageSlug)
Sets whether page-heading tabs are displayed or not.
$this->showPageHeadingTabs( false ); // disables the page heading tabs by passing false.
boolean | $fShow | If false, page-heading tabs will be disabled; otherwise, enabled. |
string | $strPageSlug | The page to apply the visibility setting. If not set, it applies to all the pages. |
showInPageTabs(boolean $fShow, string $strPageSlug)
Sets whether in-page tabs are displayed or not.
Sometimes, it is required to disable in-page tabs in certain pages. In that case, use the second parameter.
boolean | $fShow | If false, in-page tabs will be disabled. |
string | $strPageSlug | The page to apply the visibility setting. If not set, it applies to all the pages. |
setPageHeadingTabTag(string $strTag, string $strPageSlug)
Sets page-heading tab's HTML tag.
$this->setPageHeadingTabTag( 'h2' );
string | $strTag | The HTML tag that encloses the page-heading tab title. Default: h2. |
string | $strPageSlug | The page slug that applies the setting. |
addInPageTab(string $strPageSlug, string $strTabTitle, string $strTabSlug, integer $numOrder, boolean $fHide, string $strParentTabSlug) : void
Adds an in-page tab.
string | $strPageSlug | The page slug that the tab belongs to. |
string | $strTabTitle | The title of the tab. |
string | $strTabSlug | The tab slug. Non-alphabetical characters should not be used including dots(.) and hyphens(-). |
integer | $numOrder | ( optional ) the order number of the tab. The lager the number is, the lower the position it is placed in the menu. |
boolean | $fHide | ( optional ) default: false. If this is set to false, the tab title will not be displayed in the tab navigation menu; however, it is still accessible from the direct URL. |
string | $strParentTabSlug | ( optional ) this needs to be set if the above fHide is true so that the parent tab will be emphasized as active when the hidden page is accessed. |
addInPageTabs(array $arrTab1, array $arrTab2, array $_and_more) : void
Adds in-page tabs.
The parameters accept in-page tab arrays and they must have the following array keys.
$this->addInPageTabs(
array(
'strTabSlug' => 'firsttab',
'strTitle' => __( 'Text Fields', 'my-text-domain' ),
'strPageSlug' => 'myfirstpage'
),
array(
'strTabSlug' => 'secondtab',
'strTitle' => __( 'Selectors and Checkboxes', 'my-text-domain' ),
'strPageSlug' => 'myfirstpage'
)
);
array | $arrTab1 | The in-page tab array. |
array | $arrTab2 | Another in-page tab array. |
array | $_and_more | Add in-page tab arrays as many as necessary to the next parameters. |
addHelpTab(array $arrHelpTab) : void
Adds the given contextual help tab contents into the property.
$this->addHelpTab(
array(
'strPageSlug' => 'first_page', // ( mandatory )
// 'strPageTabSlug' => null, // ( optional )
'strHelpTabTitle' => 'Admin Page Framework',
'strHelpTabID' => 'admin_page_framework', // ( mandatory )
'strHelpTabContent' => __( 'This contextual help text can be set with the addHelpTab() method.', 'admin-page-framework' ),
'strHelpTabSidebarContent' => __( 'This is placed in the sidebar of the help pane.', 'admin-page-framework' ),
)
);
array | $arrHelpTab | The help tab array. The key structure is explained in the description part. |
setHelpTab( $strID, $strTitle, $arrContents, $arrSideBarContents)
Sets the contextual help tab.
On contrary to other methods relating to contextual help tabs that just modify the class properties, this finalizes the help tab contents. In other words, the set values here will take effect.
$strID | ||
$strTitle | ||
$arrContents | ||
$arrSideBarContents |