Admin Page Framework Documentation

Packages

  • AdminPageFramework
    • Common
      • Factory
      • Form
        • FieldType
      • Utility
    • Factory
      • AdminPage
      • MetaBox
      • NetworkAdmin
      • PageMetaBox
      • PostType
      • TaxonomyField
      • TermMeta
      • UserMeta
      • Widget
    • Utility

Classes

  • AdminPageFramework
  • AdminPageFramework_Controller
  • AdminPageFramework_Controller_Form
  • AdminPageFramework_Controller_Menu
  • AdminPageFramework_Controller_Page
  • AdminPageFramework_View

Resources

  • Tutorials
  • Support
  • Reporting Issues

Class AdminPageFramework_Controller_Page

Provides methods to manipulate the way admin pages are displayed.

Abstract
Package: AdminPageFramework\Factory\AdminPage
Since: 3.3.1
Since: 3.6.3 Changed the name from AdminPageFramework_Page_Controller.
Extends: AdminPageFramework_View_Page
Located at factory/admin_page/AdminPageFramework_Controller_Page.php

Methods summary

public
# addInPageTabs( )

Adds in-page tabs.

The parameters accept in-page tab arrays and they must have the following array keys.

Example

$this->addInPageTabs(
     array(
         'page_slug' => 'myfirstpage'
         'tab_slug'  => 'firsttab',
         'title'     => __( 'Text Fields', 'my-text-domain' ),
     ),
     array(
         'page_slug' => 'myfirstpage'
         'tab_slug'  => 'secondtab',
         'title'     => __( 'Selectors and Checkboxes', 'my-text-domain' ),
     )
);
$this->addInPageTabs(
     'myfirstpage', // sets the target page slug
     array(
         'tab_slug'  => 'firsttab',
         'title'     => __( 'Text Fields', 'my-text-domain' ),
     ),
     array(
         'tab_slug'  => 'secondtab',
         'title'     => __( 'Selectors and Checkboxes', 'my-text-domain' ),
     )
);

Since

2.0.0
3.0.0 Changed the scope to public. Added page slug target support.
3.3.1 Moved from AdminPageFramework_Page.

Remark

Accepts variadic parameters; the number of accepted parameters are not limited to three.
In-page tabs are different from page-heading tabs which is automatically added with page titles.
public
# addInPageTab( array|string $asInPageTab )

Adds an in-page tab.

The singular form of the addInPageTabs() method, which takes only one parameter.

Parameters

$asInPageTab
array|string
$asInPageTab The in-page tab array or the target page slug. If the target page slug is set, the page_slug key can be omitted from next calls.

Since

2.0.0
3.0.0 Changed the scope to public.
3.3.1 Moved from AdminPageFramework_Page.

Remark

Use this method to add in-page tabs to ensure the array holds all the necessary keys.
In-page tabs are different from page-heading tabs which are automatically added with page titles.
public
# setPageTitleVisibility( boolean $bShow = true, mixed $sPageSlug = '' )

Sets whether the page title is displayed or not.

Example

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

Parameters

$bShow
boolean
$bShow If false, the page title will not be displayed.
$sPageSlug

Since

2.0.0
3.0.0 Changed the scope to public.
3.3.1 Moved from AdminPageFramework_Page.
public
# setPageHeadingTabsVisibility( boolean $bShow = true, string $sPageSlug = '' )

Sets whether page-heading tabs are displayed or not.

Example

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

Parameters

$bShow
boolean
$bShow If false, page-heading tabs will be disabled; otherwise, enabled.
$sPageSlug
string
$sPageSlug The page to apply the visibility setting. If not set, it applies to all the pages.

Since

2.0.0
3.0.0 Changed the scope to public.
3.3.1 Moved from AdminPageFramework_Page.

Remark

Page-heading tabs and in-page tabs are different. The former displays page titles and the latter displays tab titles.
If the second parameter is omitted, it sets the default value.
public
# setInPageTabsVisibility( boolean $bShow = true, string $sPageSlug = '' )

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

$bShow
boolean
$bShow If false, in-page tabs will be disabled.
$sPageSlug
string
$sPageSlug The page to apply the visibility setting. If not set, it applies to all the pages.

Since

2.1.1
3.0.0 Changed the scope to public. Changed the name from showInPageTabs() to setInPageTabsVisibility().
3.3.1 Moved from AdminPageFramework_Page.

Remark

If the second parameter is omitted, it sets the default value.
public
# setInPageTabTag( string $sTag = 'h3', string $sPageSlug = '' )

Sets in-page tab's HTML tag.

Example

$this->setInPageTabTag( 'h2' );

Parameters

$sTag
string
$sTag The HTML tag that encloses each in-page tab title. Default: h3.
$sPageSlug
string
$sPageSlug The page slug that applies the setting.

Since

2.0.0
3.0.0 Changed the scope to public.
3.3.1 Moved from AdminPageFramework_Page.

Remark

If the second parameter is omitted, it sets the default value.
public
# setPageHeadingTabTag( string $sTag = 'h2', string $sPageSlug = '' )

Sets page-heading tab's HTML tag.

Example

$this->setPageHeadingTabTag( 'h2' );

Parameters

$sTag
string
$sTag The HTML tag that encloses the page-heading tab title. Default: h2.
$sPageSlug
string
$sPageSlug The page slug that applies the setting.

Since

2.1.2
3.0.0 Changed the scope to public.
3.3.1 Moved from AdminPageFramework_Page.

Remark

If the second parameter is omitted, it sets the default value.

Magic methods summary

Properties summary

Related

Indirect known subclasses

AdminPageFramework, AdminPageFramework_Controller, AdminPageFramework_Controller_Menu, AdminPageFramework_NetworkAdmin, AdminPageFramework_View

If you find undocumented functionality, please report it here.

Admin Page Framework