Admin Page Framework Documentation

Packages

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

Classes

  • AdminPageFramework_MetaBox
  • AdminPageFramework_MetaBox_Controller
  • AdminPageFramework_MetaBox_View

Resources

  • Tutorials
  • Support
  • Reporting Issues

Class AdminPageFramework_MetaBox_Controller

Provides UI related methods.

Abstract
Package: AdminPageFramework\Factory\MetaBox
Since: 3.3.0
Located at factory/meta_box/AdminPageFramework_MetaBox_Controller.php

Methods summary

public
# setUp( )

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 array
# enqueueStyles( array $aSRCs, array $aPostTypes = array(), mixed $aCustomArgs = array() )

Enqueues styles by post type.

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' )
$aPostTypes
array
(optional) The another source argument array.
$aCustomArgs

Returns

array
The array holing the queued items.

Since

3.0.0
public string
# enqueueStyle( string $sSRC, array $aPostTypes = array(), array $aCustomArgs = array() )

Enqueues a style by post type.

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
public array
# enqueueScripts( array $aSRCs, array $aPostTypes = array(), mixed $aCustomArgs = array() )

Enqueues scripts by page slug and tab slug.

Parameters

$aSRCs
array
The sources of the style-sheets to enqueue: the URL, the absolute file path, or the relative path to the root directory of WordPress. Example: '/js/myscript.js'.
$aPostTypes
array
(optional) Ad additional source list array.
$aCustomArgs

Returns

array
The array holding the queued items.

Since

3.0.0
public string
# enqueueScript( string $sSRC, string $aPostTypes = array(), string $aCustomArgs = array() )

Enqueues a script by post type.

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 - (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

Magic methods summary

Properties summary

Related

Direct known subclasses

AdminPageFramework_MetaBox

If you find undocumented functionality, please report it here.

Admin Page Framework