Properties

$oScreen

$oScreen : object

Stores the screen object.

Type

object

Methods

finalizeInPageTabs()

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.

showPageTitle()

showPageTitle(boolean $fShow,  $strPageSlug) : void

Sets whether the page title is displayed or not.

Example

$this->showPageTitle( false ); // disables the page title.

Parameters

boolean $fShow

If false, the page title will not be displayed.

$strPageSlug

showPageHeadingTabs()

showPageHeadingTabs(boolean $fShow, string $strPageSlug)

Sets whether page-heading tabs are displayed or not.

Example

$this->showPageHeadingTabs( false ); // disables the page heading tabs by passing false.

Parameters

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()

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.

Parameters

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.

setInPageTabTag()

setInPageTabTag(string $strTag, string $strPageSlug)

Sets in-page tab's HTML tag.

Example

$this->setInPageTabTag( 'h2' );

Parameters

string $strTag

The HTML tag that encloses each in-page tab title. Default: h3.

string $strPageSlug

The page slug that applies the setting.

setPageHeadingTabTag()

setPageHeadingTabTag(string $strTag, string $strPageSlug)

Sets page-heading tab's HTML tag.

Example

$this->setPageHeadingTabTag( 'h2' );

Parameters

string $strTag

The HTML tag that encloses the page-heading tab title. Default: h2.

string $strPageSlug

The page slug that applies the setting.

addInPageTab()

addInPageTab(string $strPageSlug, string $strTabTitle, string $strTabSlug, integer $numOrder, boolean $fHide, string $strParentTabSlug) : void

Adds an in-page tab.

Parameters

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()

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.

In-Page Tab Array

  • strPageSlug - ( string ) the page slug that the tab belongs to.
  • strTabSlug - ( string ) the tab slug. Non-alphabetical characters should not be used including dots(.) and hyphens(-).
  • strTitle - ( string ) the title of the tab.
  • numOrder - ( optional, integer ) the order number of the tab. The lager the number is, the lower the position it is placed in the menu.
  • fHide - ( optional, boolean ) 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.
  • strParentTabSlug - ( optional, string ) 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.

Example

$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' ) );

Parameters

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()

addHelpTab(array $arrHelpTab) : void

Adds the given contextual help tab contents into the property.

Contextual Help Tab Array Structure

  • strPageSlug - the page slug of the page that the contextual help tab and its contents are displayed.
  • strPageTabSlug - ( optional ) the tab slug of the page that the contextual help tab and its contents are displayed.
  • strHelpTabTitle - the title of the contextual help tab.
  • strHelpTabID - the id of the contextual help tab.
  • strHelpTabContent - the HTML string content of the the contextual help tab.
  • strHelpTabSidebarContent - ( optional ) the HTML string content of the sidebar of the contextual help tab.

Example

$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' ), ) );

Parameters

array $arrHelpTab

The help tab array. The key structure is explained in the description part.

setHelpTab()

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.

Parameters

$strID
$strTitle
$arrContents
$arrSideBarContents

getScreenIcon()

getScreenIcon( $strPageSlug)

Retrieves the screen icon output as HTML.

Parameters

$strPageSlug

getScreenIDAttribute()

getScreenIDAttribute( $oScreen)

Retrieves the screen ID attribute from the given screen object.

Parameters

$oScreen

getPageHeadingTabs()

getPageHeadingTabs( $strCurrentPageSlug,  $strTag,  $arrOutput) : string

Retrieves the output of page heading tab navigation bar as HTML.

Parameters

$strCurrentPageSlug
$strTag
$arrOutput

Returns

string —

the output of page heading tabs.

getInPageTabs()

getInPageTabs( $strCurrentPageSlug,  $strTag,  $arrOutput) : string

Retrieves the output of in-page tab navigation bar as HTML.

Parameters

$strCurrentPageSlug
$strTag
$arrOutput

Returns

string —

the output of in-page tabs.

getParentTabSlug()

getParentTabSlug( $strPageSlug,  $strTabSlug) : string

Retrieves the parent tab slug from the given tab slug.

Parameters

$strPageSlug
$strTabSlug

Returns

string —

the parent tab slug.