Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

  • AdminPageFramework
    • FieldType
    • MetaBox
    • Page
    • PostType
    • TaxonomyField

Classes

  • AdminPageFramework_MetaBox
  • AdminPageFramework_MetaBox_Page

Class AdminPageFramework_MetaBox_Page

Provides methods for creating meta boxes in pages added by the framework.

Hooks

The class automatically creates WordPress action and filter hooks associated with the class methods. The class methods corresponding to the name of the below actions and filters can be extended to modify the page output. Those methods are the callbacks of the filters and actions.

Methods and Action Hooks

  • start_{extended class name} – triggered at the end of the class constructor.
  • do_{extended class name} – triggered when the meta box gets rendered.

Methods and Filter Hooks

  • field_types_{extended class name} – receives the field type definition array. The first parameter: the field type definition array.
  • field_{extended class name}_{field ID} – receives the form input field output of the given input field ID. The first parameter: output string. The second parameter: the array of option.
  • content_{extended class name} – receives the entire output of the meta box. The first parameter: the output HTML string.
  • style_common_{extended class name} – receives the output of the base CSS rules applied to the pages of the associated post types with the meta box.
  • style_ie_common_{extended class name} – receives the output of the base CSS rules for Internet Explorer applied to the pages of the associated post types with the meta box.
  • style_{extended class name} – receives the output of the CSS rules applied to the pages of the associated post types with the meta box.
  • style_ie_{extended class name} – receives the output of the CSS rules for Internet Explorer applied to the pages of the associated post types with the meta box.
  • script_common_{extended class name} – receives the output of the base JavaScript scripts applied to the pages of the associated post types with the meta box.
  • script_{extended class name} – receives the output of the JavaScript scripts applied to the pages of the associated post types with the meta box.
  • validation_{extended class name} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database.
AdminPageFramework_MetaBox_Base
Extended by AdminPageFramework_MetaBox_Page
Abstract
Package: AdminPageFramework\MetaBox
Since: 3.0.0
Use: AdminPageFramework_Utility
Use: AdminPageFramework_Message
Use: AdminPageFramework_Debug
Use: AdminPageFramework_Property_Page
Located at meta_box/AdminPageFramework_MetaBox_Page.php

Methods summary

public
# __construct( string $sMetaBoxID, string $sTitle, array|string $asPageSlugs = array(), string $sContext = 'normal', string $sPriority = 'default', string $sCapability = 'manage_options', string $sTextDomain = 'admin-page-framework' )

Registers necessary hooks and internal properties.

Registers necessary hooks and internal properties.

Examples

new APF_MetaBox_For_Pages_Normal(
        'apf_metabox_for_pages_normal',         // meta box id
        __( 'Sample Meta Box For Admin Pages Inserted in Normal Area' ),        // title
        'apf_first_page',       // page slugs
        'normal',       // context
        'default'       // priority
);
include_once( APFDEMO_DIRNAME . '/example/APF_MetaBox_For_Pages_Advanced.php' );
new APF_MetaBox_For_Pages_Advanced(
        'apf_metabox_for_pages_advanced',       // meta box id
        __( 'Sample Meta Box For Admin Pages Inserted in Advanced Area' ),      // title
        'apf_first_page',       // page slugs
        'advanced',             // context
        'default'       // priority
);
include_once( APFDEMO_DIRNAME . '/example/APF_MetaBox_For_Pages_Side.php' );
new APF_MetaBox_For_Pages_Side(
        'apf_metabox_for_pages_side',   // meta box id
        __( 'Sample Meta Box For Admin Pages Inserted in Advanced Area' ),      // title
        array( 'apf_first_page', 'apf_second_page' ),   // page slugs - setting multiple slugs is possible
        'side',         // context
        'default'       // priority
);

Parameters

$sMetaBoxID
string
$sMetaBoxID The meta box ID to be created.
$sTitle
string
$sTitle The meta box title.
$asPageSlugs
array|string
$asPageSlugs the page slug(s) that the meta box belongs to. If the element is an array, it will be considered as a tab array. $asPageSlugs = array( 'settings' => array( // if the key is not numeric and the value is an array, it will be considered as a tab array. 'help', // enabled in the tab whose slug is 'help' which belongs to the page whose slug is 'settings' 'about', // enabled in the tab whose slug is 'about' which belongs to the page whose slug is 'settings' 'general', // enabled in the tab whose slug is 'general' which belongs to the page whose slug is 'settings' ), 'manage', // if the numeric key with a string value is given, the condition applies to the page slug of this string value. );
$sContext
string
$sContext The context, either 'normal', 'advanced', or 'side'.
$sPriority
string
$sPriority The priority, either 'high', 'core', 'default' or 'low'.
$sCapability
string
$sCapability The capability. See Roles and Capabilities.
$sTextDomain
string
$sTextDomain ( optional ) The text domain applied to the displayed text messages. Default: admin-page-framework.

Since

3.0.0

Overrides

AdminPageFramework_MetaBox_Base::__construct
public
# enqueueStyles( mixed $aSRCs, mixed $sPageSlug = '', mixed $sTabSlug = '', mixed $aCustomArgs = array() )

Enqueues styles by page slug and tab slug.

Enqueues styles by page slug and tab slug.

Since

3.0.0

Overrides

AdminPageFramework_MetaBox_Base::enqueueStyles
public string
# enqueueStyle( string $sSRC, string $sPageSlug = '', string $sTabSlug = '', array $aCustomArgs = array() )

Enqueues a style by page slug and tab slug.

Enqueues a style by page slug and tab slug.

Parameters

$sSRC
string
The URL of the stylesheet to enqueue, the absolute file path, or the relative path to the root directory of WordPress. Example: '/css/mystyle.css'.
$sPageSlug
string
(optional) The page slug that the stylesheet should be added to. If not set, it applies to all the pages created by the framework.
$sTabSlug
string
(optional) The tab slug that the stylesheet should be added to. If not set, it applies to all the in-page tabs in the page.
$aCustomArgs
array
(optional) The argument array for more advanced parameters.

Returns

string
The script handle ID. If the passed url is not a valid url string, an empty string will be returned.

Since

3.0.0

See

http://codex.wordpress.org/Function_Reference/wp_enqueue_style

Overrides

AdminPageFramework_MetaBox_Base::enqueueStyle
public
# enqueueScripts( mixed $aSRCs, mixed $sPageSlug = '', mixed $sTabSlug = '', mixed $aCustomArgs = array() )

Enqueues scripts by page slug and tab slug.

Enqueues scripts by page slug and tab slug.

Since

2.1.5

Overrides

AdminPageFramework_MetaBox_Base::enqueueScripts
public string
# enqueueScript( string $sSRC, string $sPageSlug = '', string $sTabSlug = '', array $aCustomArgs = array() )

Enqueues a script by page slug and tab slug.

Enqueues a script by page slug and tab slug.

Parameters

$sSRC
string
The URL of the stylesheet to enqueue, the absolute file path, or the relative path to the root directory of WordPress. Example: '/js/myscript.js'.
$sPageSlug
string
(optional) The page slug that the script should be added to. If not set, it applies to all the pages created by the framework.
$sTabSlug
string
(optional) The tab slug that the script should be added to. If not set, it applies to all the in-page tabs in the page.
$aCustomArgs
array
(optional) The argument array for more advanced parameters.

Returns

string
The script handle ID. If the passed url is not a valid url string, an empty string will be returned.

Since

3.0.0

See

http://codex.wordpress.org/Function_Reference/wp_enqueue_script

Overrides

AdminPageFramework_MetaBox_Base::enqueueScript
public
# _replyToFilterPageOptions( array $aPageOptions )

Filters the page option array.

Filters the page option array.

This is triggered from the system validation method of the main class with the validation_saved_options_{page slug} filter hook.

Parameters

$aPageOptions
array

Since

3.0.0

Methods inherited from AdminPageFramework_MetaBox_Base

__call(), _isInThePage(), _loadDefaultFieldTypeDefinitions(), _registerFields(), _replyToAddMetaBox(), _replyToDetermineToLoad(), _replyToGetFieldOutput(), _replyToGetSectionHeaderOutput(), _replyToPrintMetaBoxContents(), _replyToRegisterFormElements(), _replyToSaveMetaBoxFields(), addHelpText(), addSettingField(), addSettingFields(), addSettingSection(), addSettingSections(), getInputArray(), getSavedMetaArray(), setOptionArray(), setUp()

Magic methods summary

Properties summary

Properties inherited from AdminPageFramework_MetaBox_Base

$_sFieldsType, $_sTargetSectionTabSlug, $oDebug, $oHeadTag, $oMsg, $oUtil

Admin Page Framework Documentation API documentation generated by ApiGen 2.8.0