PHP Class WPDKListTableViewController

## Overview The WPDKListTableViewController class extends the WordPress WP_List_Table class. It add some useful methods to semplify the common procedure. This class is not a true view controller (WPDKViewController) but it is very similar.
Inheritance: extends WP_List_Table
Datei anzeigen Open project: wpxtreme/wpdk

Public Properties

Property Type Description
$column_headers array Column header
$getStatusID string Name of GET parameter for status. Default status
$id string A string id for this list table view. This id is used in class HTML markup.
$model WPDKListTableModel An instance of WPDKListTableModel class
$title string The top head view controller title
$viewController WPDKViewController The internal view controller for this list table

Protected Properties

Property Type Description
$args array Internal copy of WP_List_Table args

Public Methods

Method Description
__construct ( string $id, string $title, array $args ) : WPDKListTableViewController The child class should call this constructor from it's own constructor.
_admin_head ( )
action ( ) : boolean | string Return the current action or FALSE if no action defined.
action_result ( ) : boolean | WP_Error Return the action result.
actions ( array $args, string $status ) : mixed Utility for build a right actions list when the list table is showing items.
actions_column ( array $item, string $content, string $item_status = '', string $description = '' ) : string Return the HTML markup in order to display the content of column with row actions.
admin_head ( )
admin_print_styles ( ) Fires when styles are printed for a specific admin page based on $hook_suffix.
after_display ( ) This delegate method is called after display the table, inner the form.
before_display ( ) This delegate method is called before display the table, inner the form
before_views ( ) This delegate method is called before display views
column_cb ( array $item ) : string Return the HTML markup for the checkbox element used for multiple selections.
column_checkbox ( array $item ) : boolean Return TRUE to display the checkbox, FALSE otherwise
column_default ( array $item, string $column_name ) : mixed Display a cel content for a column.
current_action ( ) : string | boolean Get the current action selected from the bulk actions dropdown.
data ( ) : array Return the items data list. This method will be over-ridden in a sub-class.
didHeadLoad ( )
display ( ) This method override the default WP_List_Table display.
get_actions_with_status ( mixed $item, string $status ) : array Return tha array with the action for the current status
get_bulk_actions ( ) : array Return an array with the list of bulk actions used in combo menu select.
get_bulk_actions_with_status ( string $status ) : array Return the array with the buk action for the combo menu for a status of view
get_columns ( ) : array Return a key value pairs array with the list of columns
get_count_statuses ( ) : array Return the array with status key => count.
get_sortable_columns ( ) : array Return the sortable columns
get_status ( string $status ) : integer Return the count of specific status
get_statuses ( ) : array Return a key value pairs array with statuses supported
get_views ( ) : array Return an array with the HTML markup list of statuses. This method use the $statuses property format as:
html ( ) : string Return the HTML markup for list table view.
load ( )
no_items ( ) The itens can be not found for two main reason: the query search has param tha t doesn't match with items, or the items list (or the database query) return an empty list.
prepare_items ( ) : boolean Processing data items to view.
process_bulk_action ( ) : boolean Return TRUE to stop the display of list item table, FALSE otherwise. Default return FALSE if you do not override.
search_box_field ( ) Display a search box field
statuses ( $statuses ) To override
willLoad ( )
wpdk_header_view_inner_title ( WPDKHeaderView $header_view ) Fires into the the title TAG.
wpdk_list_table_remove_query_args_redirect ( array $args = [] ) Filter the query args for redirect after an actions.

Private Methods

Method Description
current_status ( string $default = '' ) : string Return the default status.

Method Details

__construct() public method

Create an instance of WPDKListTableViewController class
public __construct ( string $id, string $title, array $args ) : WPDKListTableViewController
$id string List table id
$title string Title of view controller
$args array Standard WP_List_Table args
return WPDKListTableViewController

_admin_head() public method

Since: 1.4.21
public _admin_head ( )

action() public method

Return the current action or FALSE if no action defined.
public action ( ) : boolean | string
return boolean | string

action_result() public method

Return the action result.
public action_result ( ) : boolean | WP_Error
return boolean | WP_Error

actions() public static method

Utility for build a right actions list when the list table is showing items.
Deprecation: Use the new engine subclass - used by SamrtShop
public static actions ( array $args, string $status ) : mixed
$args array
$status string
return mixed

actions_column() public method

This actions are usualy: Edit | Delete | Set Trash | etc...
public actions_column ( array $item, string $content, string $item_status = '', string $description = '' ) : string
$item array The single item
$content string The content to display and link.
$item_status string Optional. Overwrite the view status for item in a specific status.
$description string Optional. Additional description not linked.
return string

admin_head() public method

Since: 1.4.18
public admin_head ( )

admin_print_styles() public method

Fires when styles are printed for a specific admin page based on $hook_suffix.
Since: 1.6.0
public admin_print_styles ( )

after_display() public method

This delegate method is called after display the table, inner the form.
Since: 1.5.1
public after_display ( )

before_display() public method

This delegate method is called before display the table, inner the form
Since: 1.5.1
public before_display ( )

before_views() public method

This delegate method is called before display views
Since: 1.5.1
public before_views ( )

column_cb() public method

Return the HTML markup for the checkbox element used for multiple selections.
public column_cb ( array $item ) : string
$item array The single item from items
return string

column_checkbox() public method

Return TRUE to display the checkbox, FALSE otherwise
Since: 1.5.5
public column_checkbox ( array $item ) : boolean
$item array The single item from items
return boolean

column_default() public method

Display a cel content for a column.
public column_default ( array $item, string $column_name ) : mixed
$item array The single item
$column_name string Column name
return mixed

current_action() public method

Return the action name or FALSE if no action was selected.
Deprecation: - not used
Since: 1.5.1
public current_action ( ) : string | boolean
return string | boolean

data() public method

Return the items data list. This method will be over-ridden in a sub-class.
public data ( ) : array
return array

didHeadLoad() public static method

public static didHeadLoad ( )

display() public method

This method override the default WP_List_Table display.
public display ( )

get_actions_with_status() public method

Return tha array with the action for the current status
public get_actions_with_status ( mixed $item, string $status ) : array
$item mixed The item
$status string Current status
return array

get_bulk_actions() public method

Return an array with the list of bulk actions used in combo menu select.
public get_bulk_actions ( ) : array
return array

get_bulk_actions_with_status() public method

Return the array with the buk action for the combo menu for a status of view
public get_bulk_actions_with_status ( string $status ) : array
$status string Current status
return array

get_columns() public method

Return a key value pairs array with the list of columns
public get_columns ( ) : array
return array

get_count_statuses() public method

Return the array with status key => count.
Since: 1.5.16
public get_count_statuses ( ) : array
return array

get_sortable_columns() public method

Return the sortable columns
public get_sortable_columns ( ) : array
return array

get_status() public method

Return the count of specific status
Deprecation: since 1.5.16 - Use `get_count_statuses()` instead
public get_status ( string $status ) : integer
$status string
return integer

get_statuses() public method

Return a key value pairs array with statuses supported
public get_statuses ( ) : array
return array

get_views() public method

$statuses = array( 'all' => array( 'label' => __( 'All' ), 'count' => 0 ), 'publish' => array( 'label' => __( 'Publish' ), 'count' => 0 ) );
public get_views ( ) : array
return array

html() public method

Return the HTML markup for list table view.
public html ( ) : string
return string

load() public method

Since: 1.4.18
public load ( )

no_items() public method

The itens can be not found for two main reason: the query search has param tha t doesn't match with items, or the items list (or the database query) return an empty list.
public no_items ( )

prepare_items() public method

You can override this method to customize your retrived data.
public prepare_items ( ) : boolean
return boolean

process_bulk_action() public method

You can override this method to process the action request sent from list table. You can processing bulk and single action. This method must return a boolean in order to re-processed the items list view.
public process_bulk_action ( ) : boolean
return boolean

search_box_field() public method

Display a search box field
Since: 1.5.1
public search_box_field ( )

statuses() public method

To override
public statuses ( $statuses )
$statuses

willLoad() public static method

public static willLoad ( )

wpdk_header_view_inner_title() public method

Fires into the the title TAG.
public wpdk_header_view_inner_title ( WPDKHeaderView $header_view )
$header_view WPDKHeaderView An instance of WPDKHeaderView class.

wpdk_list_table_remove_query_args_redirect() public method

Filter the query args for redirect after an actions.
Since: 1.5.17
public wpdk_list_table_remove_query_args_redirect ( array $args = [] )
$args array Optional. Default query args to remove. Default `array()`

Property Details

$args protected_oe property

Internal copy of WP_List_Table args
protected array $args
return array

$column_headers public_oe property

Column header
public array $column_headers
return array

$getStatusID public_oe property

Name of GET parameter for status. Default status
Deprecation: sice 1.5.16 - Use `wpdk_` args instead
public string $getStatusID
return string

$id public_oe property

A string id for this list table view. This id is used in class HTML markup.
public string $id
return string

$model public_oe property

An instance of WPDKListTableModel class
Since: 1.3.0
public WPDKListTableModel $model
return WPDKListTableModel

$title public_oe property

The top head view controller title
public string $title
return string

$viewController public_oe property

The internal view controller for this list table
public WPDKViewController $viewController
return WPDKViewController