Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

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

Classes

  • AdminPageFramework_MetaBox

Class AdminPageFramework_MetaBox

Provides methods for creating meta boxes for post types.

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_{instantiated class name} – triggered at the end of the class constructor. This receives the class object in the first parameter.
  • set_up_{instantiated class name} – triggered after the setUp() method is called. This receives the class object in the first parameter.
  • do_{instantiated class name} – triggered when the meta box gets rendered. The first parameter: the calss object[3.1.3+].

Methods and Filter Hooks

  • field_types_{instantiated class name} – receives the field type definition array. The first parameter: the field type definition array.
  • field_{instantiated 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_{instantiated class name} – receives the entire output of the meta box. The first parameter: the output HTML string.
  • style_common_{instantiated 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_{instantiated 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_{instantiated class name} – receives the output of the CSS rules applied to the pages of the associated post types with the meta box.
  • style_ie_{instantiated 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_{instantiated class name} – receives the output of the base JavaScript scripts applied to the pages of the associated post types with the meta box.
  • script_{instantiated class name} – receives the output of the JavaScript scripts applied to the pages of the associated post types with the meta box.
  • validation_{instantiated 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.

Remarks

The slugs must not contain a dot(.) or a hyphen(-) since it is used in the callback method name.

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_MetaBox_Base
Extended by AdminPageFramework_MetaBox
Abstract
Package: AdminPageFramework\MetaBox
Since: 2.0.0
Use: AdminPageFramework_Utility
Use: AdminPageFramework_Message
Use: AdminPageFramework_Debug
Use: AdminPageFramework_Property_MetaBox
Located at factory/AdminPageFramework_MetaBox/AdminPageFramework_MetaBox.php

Methods summary

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

Constructs the class object instance of AdminPageFramework_MetaBox.

Constructs the class object instance of AdminPageFramework_MetaBox.

Sets up properties and hooks.

Example

new APF_MetaBox_BuiltinFieldTypes(
    'sample_custom_meta_box', // meta box ID
    __( 'Demo Meta Box with Built-in Field Types', 'admin-page-framework-demo' ), // title
    array( 'apf_posts' ), // post type slugs: post, page, etc.
    'normal', // context (what kind of metabox this is)
    'default' // priority
);

Parameters

$sMetaBoxID
string
The meta box ID.
$sTitle
string
The meta box title.
$asPostTypeOrScreenID
string|array
( optional ) The post type(s) or screen ID that the meta box is associated with.
$sContext
string
( optional ) The part of the page where the edit screen section should be shown ('normal', 'advanced', or 'side') Default: normal.
$sPriority
string
( optional ) The priority within the context where the boxes should show ('high', 'core', 'default' or 'low') Default: default.
$sCapability
string
( optional ) The access level to the meta box. Default: edit_posts.
$sTextDomain
string
( optional ) The text domain applied to the displayed text messages. Default: admin-page-framework.

Since

2.0.0

See

http://codex.wordpress.org/Function_Reference/add_meta_box#Parameters

Overrides

AdminPageFramework_MetaBox_Base::__construct
public
# setUp( )

The method for all necessary set-ups.

The method for all necessary set-ups.

Example

 public function setUp() {
    $this->addSettingFields(
        array(
            'field_id' => 'sample_metabox_text_field',
            'title' => 'Text Input',
            'description' => 'The description for the field.',
            'type' => 'text',
        ),
        array(
            'field_id' => 'sample_metabox_textarea_field',
            'title' => 'Textarea',
            'description' => 'The description for the field.',
            'type' => 'textarea',
            'default' => 'This is a default text value.',
        )
    );
}

Since

2.0.0

Remark

The user should override this method.

Overrides

AdminPageFramework_Factory_Controller::setUp
public
# enqueueStyles( mixed $aSRCs, mixed $aPostTypes = array(), 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_Factory_Controller::enqueueStyles
public string
# enqueueStyle( string $sSRC, array $aPostTypes = array(), 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 source of the stylesheet to enqueue: the URL, the absolute file path, or the relative path to the root directory of WordPress. Example: '/css/mystyle.css'.

Custom Argument Array

  • handle_id - ( optional, string ) The handle ID of the stylesheet.
  • dependencies - ( optional, array ) The dependency array. For more information, see codex.
  • version - ( optional, string ) The stylesheet version number.
  • media - ( optional, string ) the description of the field which is inserted into after the input field tag.
$aPostTypes
array
(optional) The post type slugs that the stylesheet should be added to. If not set, it applies to all the pages of the post types.
$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_Factory_Controller::enqueueStyle
public
# enqueueScripts( mixed $aSRCs, mixed $aPostTypes = array(), mixed $aCustomArgs = array() )

Enqueues scripts by page slug and tab slug.

Enqueues scripts by page slug and tab slug.

Since

3.0.0

Overrides

AdminPageFramework_Factory_Controller::enqueueScripts
public string
# enqueueScript( string $sSRC, string $aPostTypes = array(), string $aCustomArgs = array() )

Enqueues a script by page slug and tab slug.

Enqueues a script by page slug and tab slug.

Example

$this->enqueueScript(
plugins_url( 'asset/js/test.js' , __FILE__ ), // source url or path
array( 'my_post_type_slug' ),
array(
'handle_id' => 'my_script', // this handle ID also is used as the object name for the translation array below.
'translation' => array(
'a' => 'hello world!',
'style_handle_id' => $sStyleHandle, // check the enqueued style handle ID here.
),
)
);

Parameters

$sSRC
string
The source of the stylesheet to enqueue: the URL, the absolute file path, or the relative path to the root directory of WordPress. Example: '/js/myscript.js'.

Custom Argument Array

  • handle_id - ( optional, string ) The handle ID of the script.
  • dependencies - ( optional, array ) The dependency array. For more information, see codex.
  • version/strong> - ( optional, string ) The stylesheet version number.
  • translation - ( optional, array ) The translation array. The handle ID will be used for the object name.
  • in_footer - ( optional, boolean ) Whether to enqueue the script before </head > or before </body> Default: false.
$aPostTypes
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.
$aCustomArgs
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.

Returns

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

Since

2.1.2

See

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

Overrides

AdminPageFramework_Factory_Controller::enqueueScript

Methods inherited from AdminPageFramework_MetaBox_Base

_getInputArray(), _getSavedMetaArray(), _isInstantiatable(), _replyToAddMetaBox(), _replyToDetermineToLoad(), _replyToGetSectionHeaderOutput(), _replyToPrintMetaBoxContents(), _replyToRegisterFormElements(), _replyToSaveMetaBoxFields(), _setOptionArray()

Methods inherited from AdminPageFramework_Factory_Controller

addHelpText(), addSettingField(), addSettingFields(), addSettingSection(), addSettingSections(), hasSettingNotice(), setFieldErrors(), setSettingNotice()

Methods inherited from AdminPageFramework_Factory_View

_replyToGetFieldOutput(), _replyToPrintSettingNotice()

Methods inherited from AdminPageFramework_Factory_Model

_setUp()

Methods inherited from AdminPageFramework_Factory_Router

__call(), __get(), _getFormInstance(), _getHeadTagInstance(), _getHelpPaneInstance(), _getLinkInstancce(), _getPageLoadInfoInstance(), _isInThePage(), _replyToLoadComponents()

Magic methods summary

Properties summary

Properties inherited from AdminPageFramework_MetaBox_Base

$_sFieldsType, $_sTargetSectionTabSlug

Properties inherited from AdminPageFramework_Factory_Router

$oProp

Admin Page Framework Documentation API documentation generated by ApiGen 2.8.0