Admin Page Framework Documentation
  • Package
  • Class
  • Tree

Packages

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

Classes

  • AdminPageFramework
  • AdminPageFramework_Menu
  • AdminPageFramework_Page
  • AdminPageFramework_Setting

Class AdminPageFramework

The main class of the framework to create admin pages and forms.

This class should be extended and the setUp() method should be overridden to define how pages are composed. Most of the internal methods are prefixed with the underscore like _getSomething() and callback methods are prefixed with _reply. The methods for the users are public and do not have those prefixes.

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 the actions.

Methods and Action Hooks

  • start_{instantiated class name} – triggered at the end of the class constructor. This will be triggered in any admin page except admin-ajax.php. The class object will be passed to the first parameter [3.1.3+].
  • set_up_{instantiated class name} – [3.1.3+] triggered after the setUp() method is called. The class object will be passed to the first parameter.
  • load_{instantiated class name} – [2.1.0+] triggered when the framework's page is loaded before the header gets sent. This will not be triggered in the admin pages that are not registered by the framework. The first parameter: class object [3.1.2+].
  • load_{page slug} – [2.1.0+] triggered when the framework's page is loaded before the header gets sent. This will not be triggered in the admin pages that are not registered by the framework. The first parameter: class object [3.1.2+].
  • load_{page slug}_{tab slug} – [2.1.0+] triggered when the framework's page is loaded before the header gets sent. This will not be triggered in the admin pages that are not registered by the framework. The first parameter: class object [3.1.2+].
  • load_after_{instantiated class name} – [3.1.3+] triggered when one of the framework's pages is loaded before the header gets sent. This will not be triggered in the admin pages that are not registered by the framework. The first parameter: class object.
  • do_before_{instantiated class name} – triggered before rendering the page. It applies to all the pages created by the instantiated class object. The class object will be passed to the first parameter [3.1.3+].
  • do_before_{page slug} – triggered before rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • do_before_{page slug}_{tab slug} – triggered before rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • do_form_{instantiated class name} – triggered right after the form opening tag. It applies to all the pages created by the instantiated class object. The class object will be passed to the first parameter [3.1.3+].
  • do_form_{page slug} – triggered right after the form opening tag. The class object will be passed to the first parameter [3.1.3+].
  • do_form_{page slug}_{tab slug} – triggered right after the form opening tag. The class object will be passed to the first parameter [3.1.3+].
  • do_{instantiated class name} – triggered in the middle of rendering the page. It applies to all the pages created by the instantiated class object. The class object will be passed to the first parameter [3.1.3+].
  • do_{page slug} – triggered in the middle of rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • do_{page slug}_{tab slug} – triggered in the middle of rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • do_after_{instantiated class name} – triggered after rendering the page. It applies to all the pages created by the instantiated class object. The class object will be passed to the first parameter [3.1.3+].
  • do_after_{page slug} – triggered after rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • do_after_{page slug}_{tab slug} – triggered after rendering the page. The class object will be passed to the first parameter [3.1.3+].
  • submit_{instantiated class name}_{submit input id} – [3.0.0+] triggered after the form is submitted with the submit button of the specified input id.
  • submit_{instantiated class name}_{submit field id} – [3.0.0+] triggered after the form is submitted with the submit button of the specified field that does not hava section is submitted.
  • submit_{instantiated class name}_{submit section id}_{submit field id} – [3.0.0+] triggered after the form is submitted with the submit button of the specified section and field is submitted.
  • submit_{instantiated class name}_{submit section id} – [3.0.0+] triggered after the form is submitted with the submit button of the specified section.
  • submit_{instantiated class name} – [3.0.0+] triggered after the form is submitted.

Methods and Filter Hooks

  • content_foot_{page slug}_{tab slug} – receives the output of the top part of the page. [3.0.0+] Changed the name from head_{...}.
  • content_foot_{page slug} – receives the output of the top part of the page. [3.0.0+] Changed the name from head_{...}.
  • content_foot_{instantiated class name} – receives the output of the top part of the page, applied to all pages created by the instantiated class object. [3.0.0+] Changed the name from head_{...}.
  • content_{page slug}_{tab slug} – receives the output of the middle part of the page including form input fields.
  • content_{page slug} – receives the output of the middle part of the page including form input fields.
  • content_{instantiated class name} – receives the output of the middle part of the page, applied to all pages created by the instantiated class object.
  • content_bottom_{page slug}_{tab slug} – receives the output of the bottom part of the page. [3.0.0+] Changed the name from foot_{...}.
  • content_bottom_{page slug} – receives the output of the bottom part of the page. [3.0.0+] Changed the name from foot_{...}.
  • content_bottom_{instantiated class name} – receives the output of the bottom part of the page, applied to all pages created by the instantiated class object. [3.0.0+] Changed the name from foot_{...}.
  • section_head_{instantiated class name}_{section ID} – receives the title and the description output of the given form section ID. The first parameter: the output string.
  • field_{instantiated class name}_{field ID} – receives the form input field output of the given input field ID that does not have a section. The first parameter: output string. The second parameter: the array of option.
  • field_{instantiated class name}_{section id}_{field ID} – [3.0.0+] receives the form input field output of the given input field ID that has a section. The first parameter: output string. The second parameter: the array of option.
  • sections_{instantiated class name} – receives the registered section arrays. The first parameter: sections container array.
  • fields_{instantiated class name} – receives the registered field arrays. The first parameter: fields container array.
  • fields_{instantiated class name}_{section id} – [3.0.0+] receives the registered field arrays which belong to the specified section. The first parameter: fields container array.
  • field_definition_{instantiated class name}_{field ID} – [3.0.2+] receives the form field definition array of the given input field ID that does not have a section. The first parameter: the field definition array.
  • field_definition_{instantiated class name}_{section id}_{field ID} – [3.0.2+] receives the form field definition array of the given input field ID that has a section. The first parameter: the field definition array. The second parameter: the integer representing sub-section index if the field belongs to a sub-section.
  • pages_{instantiated class name} – receives the registered page arrays. The first parameter: pages container array.
  • tabs_{instantiated class name}_{page slug} – receives the registered in-page tab arrays. The first parameter: tabs container array.
  • validation_{instantiated class name}_{field id} – [3.0.0+] receives the form submission value of the field that does not have a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database. The third parameter: ( object ) [3.1.0+] the caller object.
  • validation_{instantiated class name}_{section_id}_{field id} – [3.0.0+] receives the form submission value of the field that has a section. The first parameter: ( string|array ) submitted input value. The second parameter: ( string|array ) the old value stored in the database. The third parameter: ( object ) [3.1.0+] the caller object.
  • validation_{instantiated class name}_{section id} – [3.0.0+] receives the form submission values that belongs to the section.. The first parameter: ( array ) the array of submitted input values that belong to the section. The second parameter: ( array ) the array of the old values stored in the database. The third parameter: ( object ) [3.1.0+] the caller object.
  • validation_{page slug}_{tab slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database. The third parameter: ( object ) [3.1.0+] the caller object.
  • validation_{page slug} – receives the form submission values as array. The first parameter: submitted input array. The second parameter: the original array stored in the database. The third parameter: ( object ) [3.1.0+] the caller object.
  • 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. The third parameter: ( object ) [3.1.0+] the caller object.
  • validation_saved_options_{instantiated class name} – [3.1.2+] receives the saved form options as an array. The first parameter: the stored options array. The second parameter: the caller object.
  • validation_saved_options_{page slug} – [3.0.0+] receives the saved form options as an array of the page. The first parameter: the stored options array of the page. The second parameter: the caller object.
  • validation_saved_options_{page slug}_{tab slug} – [3.0.0+] receives the saved form options as an array of the tab. The first parameter: the stored options array of the tab. The second parameter: the caller object.
  • style_{page slug}_{tab slug} – receives the output of the CSS rules applied to the tab page of the slug.
  • style_{page slug} – receives the output of the CSS rules applied to the page of the slug.
  • style_{instantiated class name} – receives the output of the CSS rules applied to the pages added by the instantiated class object.
  • script_{page slug}_{tab slug} – receives the output of the JavaScript script applied to the tab page of the slug.
  • script_{page slug} – receives the output of the JavaScript script applied to the page of the slug.
  • script_{instantiated class name} – receives the output of the JavaScript script applied to the pages added by the instantiated class object.
  • export_{instantiated class name}_{input id} – [2.1.5+] receives the exporting array submitted from the specific export button.
  • export_{instantiated class name}_{field id} – [2.1.5+] receives the exporting array submitted from the specific field that does not have a section.
  • export_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the exporting array submitted from the specific field that has a section.
  • export_{page slug}_{tab slug} – receives the exporting array sent from the tab page.
  • export_{page slug} – receives the exporting array submitted from the page.
  • export_{instantiated class name} – receives the exporting array submitted from the plugin.
  • export_name_{instantiated class name}_{input id} – receives the exporting file name submitted the specified input id.
  • export_name_{instantiated class name}_{field id} – receives the exporting file name submitted from the specific field that does not have a section.
  • export_name_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the exporting file name submitted from the specific field that has a section.
  • export_name_{page slug}_{tab slug} – receives the exporting file name submitted from the tab page.
  • export_name_{page slug} – receives the exporting file name submitted from the page.
  • export_name_{instantiated class name} – receives the exporting file name submitted from the script.
  • export_format_{instantiated class name}_{input id} – receives the exporting file format submitted from the specific export button.
  • export_format_{instantiated class name}_{field id} – receives the exporting file format submitted from the specific field that does not have a section.
  • export_format_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the exporting file format submitted from the specific field that has a section.
  • export_format_{page slug}_{tab slug} – receives the exporting file format sent from the tab page.
  • export_format_{page slug} – receives the exporting file format submitted from the page.
  • export_format_{instantiated class name} – receives the exporting file format submitted from the plugin.
  • import_{instantiated class name}_{input id} – [2.1.5+] receives the importing array submitted from the specific import button.
  • import_{instantiated class name}_{field id} – [2.1.5+] receives the importing array submitted from the specific import field that does not have a section.
  • import_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the importing array submitted from the specific import field that has a section.
  • import_{page slug}_{tab slug} – receives the importing array submitted from the tab page.
  • import_{page slug} – receives the importing array submitted from the page.
  • import_{instantiated class name} – receives the importing array submitted from the plugin.
  • import_mime_types_{instantiated class name}_{input id} – [2.1.5+] receives the mime types of the import data submitted from the specific import button.
  • import_mime_types_{instantiated class name}_{field id} – [2.1.5+] receives the mime types of the import data submitted from the specific import field that does not have a section.
  • import_mime_types_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the mime types of the import data submitted from the specific import field that has a section.
  • import_mime_types_{page slug}_{tab slug} – receives the mime types of the import data submitted from the tab page.
  • import_mime_types_{page slug} – receives the mime types of the import data submitted from the page.
  • import_mime_types_{instantiated class name} – receives the mime types of the import data submitted from the plugin.
  • import_format_{instantiated class name}_{input id} – [2.1.5+] receives the import data format submitted from the specific import button.
  • import_format_{instantiated class name}_{field id} – [2.1.5+] receives the import data format submitted from the specific import field that does not have a section.
  • import_format_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the import data format submitted from the specific import field that has a section.
  • import_format_{page slug}_{tab slug} – receives the import data format submitted from the tab page.
  • import_format_{page slug} – receives the import data format submitted from the page.
  • import_format_{instantiated class name} – receives the import data format submitted from the plugin.
  • import_option_key_{instantiated class name}_{input id} – [2.1.5+] receives the option array key of the importing array submitted from the specific import button.
  • import_option_key_{instantiated class name}_{field id} – [2.1.5+] receives the option array key of the importing array submitted from the specific import field that does not have a section.
  • import_option_key_{instantiated class name}_{section id}_{field id} – [3.0.0+] receives the option array key of the importing array submitted from the specific import field that has a section.
  • import_option_key_{page slug}_{tab slug} – receives the option array key of the importing array submitted from the tab page.
  • import_option_key_{page slug} – receives the option array key of the importing array submitted from the page.
  • import_option_key_{instantiated class name} – receives the option array key of the importing array submitted from the plugin.
  • options_{instantiated class name} – [3.1.0+] receives the option array.

Remarks

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

Examples

If the instantiated class name is Sample_Admin_Pages, defining the following class method will embed a banner image in all pages created by the class.

class Sample_Admin_Pages extends AdminPageFramework {
...
    function content_foot_Sample_Admin_Pages( $sContent ) {
        return '<div style="float:right;"><img src="' . plugins_url( 'img/banner468x60.gif', __FILE__ ) . '" /></div>'
            . $sContent;
    }
...
}

If the created page slug is my_first_setting_page, defining the following class method will filter the middle part of the page output.

class Sample_Admin_Pages extends AdminPageFramework {
...
    function content_my_first_setting_page( $sContent ) {
        return $sContent . '<p>Hello world!</p>';
    }
...
}

Timing of Hooks

------ After the class is instantiated ------

 start_{instantiated class name}

------ When the page starts loading  ------

 load_{instantiated class name}
 load_{page slug}
 load_{page slug}_{tab slug}
 load_after_{instantiated class name}

 sections_{instantiated class name}
 fields_{instantiated class name}
 pages_{instantiated class name}
 tabs_{instantiated class name}_{page slug}

 submit_{instantiated class name}_{pressed submit field id}
 submit_{instantiated class name}_{section id}
 submit_{instantiated class name}_{section id}_{field id}
 submit_{instantiated class name}_{page slug}
 submit_{instantiated class name}_{page slug}_{tab slug}
 submit_{instantiated class name}
 validation_saved_options_{instantiated class name}
 validation_saved_options_{page slug}_{tab slug}
 validation_saved_options_{page slug}
 validation_{instantiated class name}_{field id (which does not have a section)}
 validation_{instantiated class name}_{section_id}
 validation_{instantiated class name}_{section id}_{field id}
 validation_{page slug}_{tab slug}
 validation_{page slug }
 validation_{instantiated class name }
 export_{page slug}_{tab slug}
 export_{page slug}
 export_{instantiated class name}
 import_{page slug}_{tab slug}
 import_{page slug}
 import_{instantiated class name}

 ------ Start Rendering HTML - after HTML header is sent ------

 <head>
     <style type="text/css" name="admin-page-framework">
         style_{page slug}_{tab slug}
         style_{page slug}
         style_{instantiated class name}
         script_{page slug}_{tab slug}
         script_{page slug}
         script_{instantiated class name}
     </style>

 <head/>

 do_before_{instantiated class name}
 do_before_{page slug}
 do_before_{page slug}_{tab slug}

 <div class="wrap">

     content_top_{page slug}_{tab slug}
     content_top_{page slug}
     content_top_{instantiated class name}

     <div class="admin-page-framework-container">
         <form action="current page" method="post">

             do_form_{instantiated class name}
             do_form_{page slug}
             do_form_{page slug}_{tab slug}

             field_definition_{instantiated class name}_{section ID}_{field ID}
             field_definition_{instantiated class name}_{field ID (which does not have a section)}
             section_head_{instantiated class name}_{section ID}
             field_{instantiated class name}_{field ID}

             content_{page slug}_{tab slug}
             content_{page slug}
             content_{instantiated class name}

             do_{instantiated class name}
             do_{page slug}
             do_{page slug}_{tab slug}

         </form>
     </div>

         content_bottom_{page slug}_{tab slug}
         content_bottom_{page slug}
         content_bottom_{instantiated class name}

 </div>

 do_after_{instantiated class name}
 do_after_{page slug}
 do_after_{page slug}_{tab slug}

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_Base
Extended by AdminPageFramework_Page_MetaBox
Extended by AdminPageFramework_Page
Extended by AdminPageFramework_Menu
Extended by AdminPageFramework_Setting_Base
Extended by AdminPageFramework_Setting_Port
Extended by AdminPageFramework_Setting_Validation
Extended by AdminPageFramework_Setting
Extended by AdminPageFramework

Direct known subclasses

AdminPageFramework_NetworkAdmin

Abstract
Package: AdminPageFramework\Page
Since: 2.0.0
Extends: AdminPageFramework_Setting
Remark: This class stems from several abstract classes.
Use: AdminPageFramework_Property_Page
Use: AdminPageFramework_Debug
Use: AdminPageFramework_Property_Page
Use: AdminPageFramework_Message
Use: AdminPageFramework_Link_Page
Use: AdminPageFramework_Utility
Located at factory/AdminPageFramework/AdminPageFramework.php

Methods summary

public
# __construct( string $sOptionKey = null, string $sCallerPath = null, string $sCapability = 'manage_options', string $sTextDomain = 'admin-page-framework' )

Registers necessary callbacks ans sets up internal components including properties.

Registers necessary callbacks ans sets up internal components including properties.

Example

if ( is_admin() ) {
    new MyAdminPageClass( 'my_custom_option_key', __FILE__ );
}

Parameters

$sOptionKey
string
$sOptionKey ( optional ) specifies the option key name to store in the options table. If this is not set, the instantiated class name will be used.
$sCallerPath
string
$sCallerPath ( optional ) used to retrieve the plugin/theme details to auto-insert the information into the page footer.
$sCapability
string
$sCapability ( optional ) sets the overall access level to the admin pages created by the framework. The used capabilities are listed here. The capability can be set per page, tab, setting section, setting field. Default: manage_options
$sTextDomain
string
$sTextDomain ( optional ) the text domain used for the framework's system messages. Default: admin-page-framework.

Returns


returns nothing.

Since

2.0.0

See

http://codex.wordpress.org/Roles_and_Capabilities
http://codex.wordpress.org/I18n_for_WordPress_Developers#Text_Domains
public
# setUp( )

The method for all the necessary set-ups.

The method for all the necessary set-ups.

The users should override this method to set-up necessary settings. To perform certain tasks prior to this method, use the start_{instantiated class name} hook that is triggered at the end of the class constructor.

Example

public function setUp() {
    $this->setRootMenuPage( 'APF Form' );
    $this->addSubMenuItems(
        array(
            'title' => 'Form Fields',
            'page_slug' => 'apf_form_fields',
        )
    );
    $this->addSettingSections(
        array(
            'section_id' => 'text_fields',
            'page_slug' => 'apf_form_fields',
            'title' => 'Text Fields',
            'description' => 'These are text type fields.',
        )
    );
    $this->addSettingFields(
        array(
            'field_id' => 'text',
            'section_id' => 'text_fields',
            'title' => 'Text',
            'type' => 'text',
        )
    );
}

Since

2.0.0

Remark

This is a callback for the wp_loaded hook.
In v1, this is triggered with the admin_menu hook; however, in v2, this is triggered with the wp_loaded hook.
public
# addHelpTab( array $aHelpTab )

Adds the given contextual help tab contents into the property.

Adds the given contextual help tab contents into the property.

Example

 $this->addHelpTab(
array(
'page_slug' => 'first_page', // ( mandatory )
// 'page_tab_slug' => null, // ( optional )
'help_tab_title' => 'Admin Page Framework',
'help_tab_id' => 'admin_page_framework', // ( mandatory )
'help_tab_content' => __( 'This contextual help text can be set with the <em>addHelpTab()</em> method.', 'admin-page-framework' ),
'help_tab_sidebar_content' => __( 'This is placed in the sidebar of the help pane.', 'admin-page-framework' ),
)
);

Parameters

$aHelpTab
array
The help tab array.

Contextual Help Tab Array Structure

  • page_slug - ( required ) the page slug of the page that the contextual help tab and its contents are displayed.
  • page_tab_slug - ( optional ) the tab slug of the page that the contextual help tab and its contents are displayed.
  • help_tab_title - ( required ) the title of the contextual help tab.
  • help_tab_id - ( required ) the id of the contextual help tab.
  • help_tab_content - ( optional ) the HTML string content of the the contextual help tab.
  • help_tab_sidebar_content - ( optional ) the HTML string content of the sidebar of the contextual help tab.

Since

2.1.0

Remark

Called when registering setting sections and fields.
public array
# enqueueStyles( array $aSRCs, string $sPageSlug = '', string $sTabSlug = '', array $aCustomArgs = array() )

Enqueues styles by page slug and tab slug.

Enqueues styles by page slug and tab slug.

Use this method to pass multiple files to the same page.

Example

$this->enqueueStyle(
        array(
            dirname( APFDEMO_FILE ) . '/asset/css/code.css',
            dirname( APFDEMO_FILE ) . '/asset/css/code2.css',
        ),
        'apf_manage_options'
);

Parameters

$aSRCs
array
The sources of the stylesheet to enqueue: the url, the absolute file path, or the relative path to the root directory of WordPress. Example: array( '/css/mystyle.css', '/css/mystyle2.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

array
The array holing the queued items.

Since

3.0.0
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.

Example

$this->enqueueStyle(  dirname( APFDEMO_FILE ) . '/asset/css/code.css', 'apf_manage_options' );
$this->enqueueStyle(  plugins_url( 'asset/css/readme.css' , APFDEMO_FILE ) , 'apf_read_me' );

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'.
$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.

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 the after the input field tag.

Returns

string
The style 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_style
public array
# enqueueScripts( array $aSRCs, string $sPageSlug = '', string $sTabSlug = '', array $aCustomArgs = array() )

Enqueues scripts by page slug and tab slug.

Enqueues scripts by page slug and tab slug.

Example

$this->enqueueScripts(
    array(
plugins_url( 'asset/js/test.js' , __FILE__ ), // source url or path
plugins_url( 'asset/js/test2.js' , __FILE__ ),
    )
    'apf_read_me',     // page slug
);

Parameters

$aSRCs
array
The sources of the stylesheets to enqueue: the URL, 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

array
The array holding the queued items.

Since

2.1.5
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.

Example

$this->enqueueScript(
plugins_url( 'asset/js/test.js' , __FILE__ ), // source url or path
'apf_read_me',     // page slug
'',     // tab 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 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.

Argument Array

  • handle_id - ( optional, string ) The handle ID of the script.
  • dependencies - ( optional, array ) The dependency array. For more information, see codex.
  • version - ( 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.

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
3.0.0 Changed the scope to public

See

http://codex.wordpress.org/Function_Reference/wp_enqueue_script
public
# addLinkToPluginDescription( string $sTaggedLinkHTML1, string $sTaggedLinkHTML2 = null, string $_and_more = null )

Adds the given link(s) into the description cell of the plugin listing table.

Adds the given link(s) into the description cell of the plugin listing table.

Example

$this->addLinkToPluginDescription(
"<a href='http://www.google.com'>Google</a>",
"<a href='http://www.yahoo.com'>Yahoo!</a>"
);

Parameters

$sTaggedLinkHTML1
string
the tagged HTML link text.
$sTaggedLinkHTML2
string
( optional ) another tagged HTML link text.
$_and_more
string
( optional ) add more as many as want by adding items to the next parameters.

Since

2.0.0
3.0.0 Changed the scope to public from protected.

Remark

Accepts variadic parameters; the number of accepted parameters are not limited to three.
public
# addLinkToPluginTitle( string $sTaggedLinkHTML1, string $sTaggedLinkHTML2 = null, string $_and_more = null )

Adds the given link(s) into the title cell of the plugin listing table.

Adds the given link(s) into the title cell of the plugin listing table.

Example

$this->addLinkToPluginTitle(
"<a href='http://www.wordpress.org'>WordPress</a>"
);

Parameters

$sTaggedLinkHTML1
string
the tagged HTML link text.
$sTaggedLinkHTML2
string
( optional ) another tagged HTML link text.
$_and_more
string
( optional ) add more as many as want by adding items to the next parameters.

Since

2.0.0
3.0.0 Changed the scope to public from protected.

Remark

Accepts variadic parameters; the number of accepted parameters are not limited to three.
public
# setPluginSettingsLinkLabel( mixed $sLabel )

Sets the label applied to the settings link which automatically embedded to the plugin listing table of the plugin title cell.

Sets the label applied to the settings link which automatically embedded to the plugin listing table of the plugin title cell.

To disable the embedded settings link, pass an empty value.

Since

3.1.0
public
# setCapability( string $sCapability )

Sets the overall capability.

Sets the overall capability.

Example

$this->setCpability( 'read' ); // let subscribers access the pages.

Parameters

$sCapability
string
The access level for the created pages.

Since

2.0.0
3.0.0 Changed the scope to public from protected.

See

http://codex.wordpress.org/Roles_and_Capabilities
public
# setFooterInfoLeft( string $sHTML, boolean $bAppend = true )

Sets the given HTML text into the footer on the left hand side.

Sets the given HTML text into the footer on the left hand side.

Example

$this->setFooterInfoLeft( '<br />Custom Text on the left hand side.' );

Parameters

$sHTML
string
The HTML code to insert.
$bAppend
boolean
If true, the text will be appended; otherwise, it will replace the default text.

Since

2.0.0
3.0.0 Changed the scope to public from protected.
public
# setFooterInfoRight( string $sHTML, boolean $bAppend = true )

Sets the given HTML text into the footer on the right hand side.

Sets the given HTML text into the footer on the right hand side.

Example

$this->setFooterInfoRight( '<br />Custom Text on the right hand side.' );

Parameters

$sHTML
string
The HTML code to insert.
$bAppend
boolean
If true, the text will be appended; otherwise, it will replace the default text.

Since

2.0.0
3.0.0 Changed the scope to public from protected.
public
# setAdminNotice( string $sMessage, string $sClassSelector = 'error', string $sID = '' )

Sets an admin notice.

Sets an admin notice.

Example

$this->setAdminNotice( sprintf( 'Please click <a href="%1$s">here</a> to upgrade the options.', admin_url( 'admin.php?page="my_page"' ) ), 'updated' );

Parameters

$sMessage
string
The message to display
$sClassSelector
string
( optional ) The class selector used in the message HTML element. 'error' and 'updated' are prepared by WordPress but it's not limited to them and can pass a custom name. Default: 'error'
$sID
string
( optional ) The ID of the message. If not set, the hash of the message will be used.

Since

2.1.2
3.0.0 Changed the scope to public from protected.

Remark

It should be used before the 'admin_notices' hook is triggered.
public
# setDisallowedQueryKeys( array|string $asQueryKeys, boolean $bAppend = true )

Sets the disallowed query keys in the links that the framework generates.

Sets the disallowed query keys in the links that the framework generates.

Example

$this->setDisallowedQueryKeys( 'my-custom-admin-notice' );

Parameters

$asQueryKeys
array|string
The query key(s) to disallow.
$bAppend
boolean
If true, the passed key(s) will be appended to the property; otherwise, it will override the property.

Since

2.1.2
3.0.0 It also accepts a string. Changed the scope to public.
public static mixed
# getOption( string $sOptionKey, string $asKey = null , mixed $vDefault = null )

Retrieves the saved option value from the given option key and the dimensional array key representation.

Retrieves the saved option value from the given option key and the dimensional array key representation.

Example

$aData = AdminPageFramework::getOption( 'APF' );
$aSection = AdminPageFramework::getOption( 'APF', 'my_section' );
$sText = AdminPageFramework::getOption( 'APF', array( 'my_section', 'my_text_field' ), 'foo' );
$sColor = AdminPageFramework::getOption( 'APF', 'my_color_field', '#FFF' );

Parameters

$sOptionKey
string
$sOptionKey the option key of the options table.
$asKey
string
$asKey the representation of dimensional array keys. If the returning option structure is like the following, array( 'a' => array( 'b' => array( 'c' => 'ccc', ), ), ) then the value 'ccc' can be retrieved with the key representation array of array( 'a', 'b', 'c' )
$vDefault
mixed
$vDefault the default value that will be returned if nothing is stored.

Returns

mixed
If the field ID is not specified

Since

3.0.1

Methods inherited from AdminPageFramework_Setting

addSettingField(), addSettingFields(), addSettingSection(), addSettingSections(), getFieldValue(), removeSettingFields(), removeSettingSections()

Methods inherited from AdminPageFramework_Setting_Validation

_doValidationCall(), _handleSubmittedData()

Methods inherited from AdminPageFramework_Setting_Port

_exportOptions(), _importOptions()

Methods inherited from AdminPageFramework_Setting_Base

_replyToCheckRedirects(), _replyToGetFieldOutput(), _replyToGetSectionHeaderOutput(), _replyToRegisterSettings()

Methods inherited from AdminPageFramework_Menu

addSubMenuItem(), addSubMenuItems(), setRootMenuPage(), setRootMenuPageBySlug()

Methods inherited from AdminPageFramework_Page

_replyToFinalizeInPageTabs(), addInPageTab(), addInPageTabs(), setInPageTabTag(), setInPageTabsVisibility(), setPageHeadingTabTag(), setPageHeadingTabsVisibility(), setPageTitleVisibility()

Methods inherited from AdminPageFramework_Page_MetaBox

_getNumberOfColumns(), _printMetaBox(), _replyToAddMetaboxScript(), _replyToEnableMetaBox(), _replyToReturnDefaultNumberOfScreenColumns(), _replyToSetNumberOfScreenLayoutColumns()

Methods inherited from AdminPageFramework_Base

__call(), _doPageLoadCall(), _isInThePage(), _isInstantiatable(), _sortByOrder(), addSubMenuLink(), addSubMenuPage(), addSubMenuPages()

Methods inherited from AdminPageFramework_Factory_Controller

addHelpText(), hasSettingNotice(), setFieldErrors(), setSettingNotice()

Methods inherited from AdminPageFramework_Factory_View

_replyToPrintSettingNotice()

Methods inherited from AdminPageFramework_Factory_Model

_setUp()

Methods inherited from AdminPageFramework_Factory_Router

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

Magic methods summary

Properties summary

Properties inherited from AdminPageFramework_Setting_Base

$_sFieldsType, $_sTargetPageSlug, $_sTargetSectionTabSlug, $_sTargetTabSlug, $aFieldErrors

Properties inherited from AdminPageFramework_Base

$_aHookPrefixes, $oProp

Admin Page Framework Documentation API documentation generated by ApiGen 2.8.0