Admin Page Framework Documentation

Packages

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

Classes

  • AdminPageFramework_PostType
  • AdminPageFramework_PostType_Controller
  • AdminPageFramework_PostType_View

Resources

  • Tutorials
  • Support
  • Reporting Issues

Class AdminPageFramework_PostType_Controller

Provides methods of views for the post type factory class.

Those methods are public and provides means for users to set property values.

Abstract
Package: AdminPageFramework\Factory\PostType
Since: 3.0.4
Located at factory/post_type/AdminPageFramework_PostType_Controller.php

Methods summary

public
# setUp( )

The method for necessary set-ups.

Example

public function setUp() {
        $this->setAutoSave( false );
        $this->setAuthorTableFilter( true );
        $this->addTaxonomy(
            'sample_taxonomy', // taxonomy slug
            array( // argument - for the argument array keys, refer to : http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments
                'labels'              => array(
                    'name'            => 'Genre',
                    'add_new_item'    => 'Add New Genre',
                    'new_item_name'   => "New Genre"
                ),
                'show_ui'                 => true,
                'show_tagcloud'           => false,
                'hierarchical'            => true,
                'show_admin_column'       => true,
                'show_in_nav_menus'       => true,
                'show_table_filter'       => true, // framework specific key
                'show_in_sidebar_menus'   => false, // framework specific key
            )
        );
    }

Since

2.0.0

Callback

action init

Remark

The user should override this method in their class definition.
A callback for the wp_loaded hook.

Overrides

AdminPageFramework_Factory_Controller::setUp
public
# load( )

Gets called when the edit.php of the post type starts loading.

Since

3.7.10

Overrides

AdminPageFramework_Factory_Controller::load
public array
# enqueueStyles( )

Enqueues styles of the given sources.

Returns

array
An array holding the handle IDs of queued items.

Since

3.0.0
3.8.31 Removed parameters to be compatible with the base class.
public string
# enqueueStyle( )

Enqueues a style of the given source.

Returns

string
The added resource handle iD.

Since

3.0.0
3.8.31 Removed parameters to be compatible with the base class.
public array
# enqueueScripts( )

Enqueues scripts by the given sources.

Example

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

Returns

array
An array holding the handle IDs of queued items.

Since

3.0.0
3.8.31 Removed parameters to be compatible with the base class.
public string
# enqueueScript( )

Enqueues a script by the given source.

Example

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

Returns

string
The added resource handle iD.

Since

3.0.0
3.8.31 Removed parameters to be compatible with the base class.
protected
# setAutoSave( boolean $bEnableAutoSave = True )

Enables or disables the auto-save feature in the custom post type's post submission page.

Example

$this->setAutoSave( false );

Parameters

$bEnableAutoSave
boolean
If true, it enables the auto-save; otherwise, it disables it. return void

Since

2.0.0
protected
# addTaxonomy( string $sTaxonomySlug, array $aArguments, array $aAdditionalObjectTypes = array() )
Adds a custom taxonomy to the class post type.

Example

$this->addTaxonomy(
  'sample_taxonomy', // taxonomy slug
  array( // argument
      'labels'        => array(
      'name'          => 'Genre',
      'add_new_item'  => 'Add New Genre',
      'new_item_name' => "New Genre"
  ),
  'show_ui'               => true,
  'show_tagcloud'         => false,
  'hierarchical'          => true,
  'show_admin_column'     => true,
  'show_in_nav_menus'     => true,
  'show_table_filter'     => true,  // framework specific key
  'show_in_sidebar_menus' => false, // framework specific key
  )
);

Parameters

$sTaxonomySlug
string
$sTaxonomySlug The taxonomy slug.
$aArguments
array
$aArguments The taxonomy argument array passed to the second parameter of the register_taxonomy() function.
$aAdditionalObjectTypes
array
$aAdditionalObjectTypes Additional object types (post types) besides the caller post type.

Since

2.0.0
3.1.1 Added the third parameter.

See

http://codex.wordpress.org/Function_Reference/register_taxonomy#Arguments
protected
# setAuthorTableFilter( boolean $bEnableAuthorTableFileter = false )

Sets whether the author drop-down filter is enabled/disabled in the post type post list table.

Example

$this->setAuthorTableFilter( true );

Parameters

$bEnableAuthorTableFileter
boolean
$bEnableAuthorTableFileter If true, it enables the author filter; otherwise, it disables it.

Since

2.0.0
protected
# setArguments( array $aArguments = array() )

Sets the post type arguments.

Parameters

$aArguments
array
$aArguments The array of arguments to be passed to the second parameter of the register_post_type() function.

Since

3.2.0

See

http://codex.wordpress.org/Function_Reference/register_post_type#Arguments

Remark

The alias of setPostTypeArgs().

Magic methods summary

Properties summary

Related

Direct known subclasses

AdminPageFramework_PostType

If you find undocumented functionality, please report it here.

Admin Page Framework