Class AdminPageFramework_Controller
Provides methods for the user to define how the outputs are displayed.
Package: AdminPageFramework\Factory\AdminPage
Since: 3.3.1
Located at factory/admin_page/AdminPageFramework_Controller.php
Methods summary
public
|
#
load( )
Called when one of the added admin page starts loading. Alternatively the user may use the Since
3.7.12
Overrides |
public
|
#
setUp( )
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 Examplepublic function setUp() { $this->setRootMenuPage( 'APF Form' ); $this->addSubMenuItems( array( 'title' => 'Form Fields', 'page_slug' => 'apf_form_fields', ) ); } Since
2.0.0
3.3.1 Moved from AdminPageFramework .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.Overrides |
public
|
#
addHelpTab( array $aHelpTab )
Adds the given contextual help tab contents into the property. Example$this->addHelpTab( array( 'page_slug => 'first_page', // (required) // 'page_tab_slug' => null, // (optional) 'help_tab_title' => 'Admin Page Framework', 'help_tab_id' => 'admin_page_framework', // (required) 'help_tab_content' => __( 'This contextual help text can be set with the `addHelpTab()` method.', 'admin-page-framework' ), 'help_tab_sidebar_content' => __( 'This is placed in the sidebar of the help pane.', 'admin-page-framework' ), ) ); Parameters
Since
2.1.0
3.3.1 Moved from AdminPageFramework .Remark
Called when registering setting sections and fields.
|
public
array
|
#
enqueueStyles( )
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' // page slug ); Returnsarray The array holing the queued items. Since
3.0.0
3.3.1 Moved from AdminPageFramework . |
public
string
|
#
enqueueStyle( )
Enqueues a style by page slug and tab slug. Example$this->enqueueStyle( dirname( APFDEMO_FILE ) . '/asset/css/code.css', 'apf_manage_options' // page slug ); $this->enqueueStyle( plugins_url( 'asset/css/readme.css' , APFDEMO_FILE ), 'apf_read_me' // page slug ); Returnsstring The style handle ID. If the passed url is not a valid url string, an empty string will be returned. Since
2.1.2
3.3.1 Moved from AdminPageFramework .See |
public
array
|
#
enqueueScripts( )
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 ); Returnsarray The array holding the queued items. Since
2.1.5
3.3.1 Moved from AdminPageFramework . |
public
string
|
#
enqueueScript( )
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. ), ) ); Returnsstring 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 3.3.1 Moved from AdminPageFramework .See |
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. Example$this->addLinkToPluginDescription( "<a href='http://www.google.com'>Google</a>", "<a href='http://www.yahoo.com'>Yahoo!</a>" ); Parameters
Since
2.0.0
3.0.0 Changed the scope to public from protected. 3.3.1 Moved from AdminPageFramework .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. Example$this->addLinkToPluginTitle( "<a href='http://www.wordpress.org'>WordPress</a>" ); Parameters
Since
2.0.0
3.0.0 Changed the scope to public from protected. 3.3.1 Moved from AdminPageFramework .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. To disable the embedded settings link, pass an empty value. Since
3.1.0
3.3.1 Moved from AdminPageFramework . |
public
|
#
setCapability( string $sCapability )
Sets the overall capability. Example$this->setCapability( 'read' ); // let subscribers access the pages. Parameters
Since
2.0.0
3.0.0 Changed the scope to public from protected. 3.3.1 Moved from AdminPageFramework .See |
public
|
#
setAdminNotice( string $sMessage, string $sClassSelector = 'error', string $sID = '' )
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
Since
2.1.2
3.0.0 Changed the scope to public from protected. 3.3.1 Moved from AdminPageFramework .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. Example$this->setDisallowedQueryKeys( 'my-custom-admin-notice' ); Parameters
Since
2.1.2
3.0.0 It also accepts a string. Changed the scope to public. 3.3.1 Moved from AdminPageFramework . |
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. 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
Returnsmixed If the field ID is not specified Since
3.0.1
3.3.1 Moved from AdminPageFramework . |