PHP Class WordPress\ORM\Admin\ListTable

Author: Brandon Wamboldt ([email protected])
ファイルを表示 Open project: brandonwamboldt/wp-orm

Protected Properties

Property Type Description
$actions array
$args array
$items array
$pagination string
$pagination_args array
$screen object

Public Methods

Method Description
__construct ( array $args = [] ) Constructor. The child class should call this constructor from its own constructor
ajax_response ( ) Handle an incoming ajax request (called from admin-ajax.php).
ajax_user_can ( ) Checks the current user's permissions.
bulk_actions ( ) Display the bulk actions dropdown.
current_action ( ) : string | boolean Get the current action selected from the bulk actions dropdown.
display ( ) Display the table.
get_column_count ( ) : integer Return number of visible columns.
get_pagenum ( ) : integer Get the current page number
get_pagination_arg ( string $key ) : array Access the pagination args.
get_search_query ( $escaped = true ) Cause the real one doesn't work.
has_items ( ) : boolean Whether the table has items to display or not.
no_items ( ) Message to be displayed when there are no items.
prepare_items ( ) Prepares the list of items for displaying.
search_box ( string $text, string $input_id ) Display the search box.
views ( ) Display the list of views available on this table.

Protected Methods

part of the table. part of the table.
Method Description
comments_bubble ( integer $post_id, integer $pending_comments ) Display a comment count bubble
display_rows ( ) Generate the table rows.
display_rows_or_placeholder ( ) Generate the
display_tablenav ( $which ) Generate the table navigation above or below the table.
extra_tablenav ( $which ) Extra controls to be displayed between bulk actions and pagination.
get_bulk_actions ( ) : array Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table.
get_column_info ( ) : array Get a list of all, hidden and sortable columns, with filter applied
get_columns ( ) : array Get a list of columns. The format is: 'internal-name' => 'Title'
get_items_per_page ( $option, $default = 20 ) : integer Get number of items to display on a single page
get_sortable_columns ( ) : array Get a list of sortable columns. The format is: 'internal-name' => 'orderby' or 'internal-name' => array( 'orderby', true )
get_table_classes ( ) : array Get a list of CSS classes for the tag
get_views ( ) : array Get an associative array ( id => link ) with the list of views available on this table.
js_vars ( ) Send required variables to JavaScript land.
months_dropdown ( $post_type ) Display a monthly dropdown for filtering items
pagination ( $which ) Display the pagination.
print_column_headers ( boolean $with_id = true ) Print column headers, accounting for hidden and sortable columns.
row_actions ( array $actions, boolean $always_visible = false ) : string Generate row actions div
set_pagination_args ( array $args ) An internal method that sets all the necessary pagination arguments.
single_row ( object $item ) Generates content for a single row of the table.
single_row_columns ( object $item ) Generates the columns for a single row of the table.
view_switcher ( $current_mode ) Display a view switcher

Method Details

__construct() public method

Constructor. The child class should call this constructor from its own constructor
public __construct ( array $args = [] )
$args array

ajax_response() public method

Handle an incoming ajax request (called from admin-ajax.php).
public ajax_response ( )

ajax_user_can() abstract public method

Checks the current user's permissions.
abstract public ajax_user_can ( )

bulk_actions() public method

Display the bulk actions dropdown.
public bulk_actions ( )

comments_bubble() protected method

Display a comment count bubble
protected comments_bubble ( integer $post_id, integer $pending_comments )
$post_id integer
$pending_comments integer

current_action() public method

Get the current action selected from the bulk actions dropdown.
public current_action ( ) : string | boolean
return string | boolean

display() public method

Display the table.
public display ( )

display_rows() protected method

Generate the table rows.
protected display_rows ( )

display_rows_or_placeholder() protected method

Generate the
protected display_rows_or_placeholder ( )

display_tablenav() protected method

Generate the table navigation above or below the table.
protected display_tablenav ( $which )

extra_tablenav() protected method

Extra controls to be displayed between bulk actions and pagination.
protected extra_tablenav ( $which )

get_bulk_actions() protected method

Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table.
protected get_bulk_actions ( ) : array
return array

get_column_count() public method

Return number of visible columns.
public get_column_count ( ) : integer
return integer

get_column_info() protected method

Get a list of all, hidden and sortable columns, with filter applied
protected get_column_info ( ) : array
return array

get_columns() abstract protected method

Get a list of columns. The format is: 'internal-name' => 'Title'
abstract protected get_columns ( ) : array
return array

get_items_per_page() protected method

Get number of items to display on a single page
protected get_items_per_page ( $option, $default = 20 ) : integer
return integer

get_pagenum() public method

Get the current page number
public get_pagenum ( ) : integer
return integer

get_pagination_arg() public method

Access the pagination args.
public get_pagination_arg ( string $key ) : array
$key string
return array

get_search_query() public method

Cause the real one doesn't work.
public get_search_query ( $escaped = true )

get_sortable_columns() protected method

The second format will make the initial sorting order be descending.
protected get_sortable_columns ( ) : array
return array

get_table_classes() protected method

Get a list of CSS classes for the tag
protected get_table_classes ( ) : array
return array

get_views() protected method

Get an associative array ( id => link ) with the list of views available on this table.
protected get_views ( ) : array
return array

has_items() public method

Whether the table has items to display or not.
public has_items ( ) : boolean
return boolean

js_vars() protected method

Send required variables to JavaScript land.
protected js_vars ( )

months_dropdown() protected method

Display a monthly dropdown for filtering items
protected months_dropdown ( $post_type )

no_items() public method

Message to be displayed when there are no items.
public no_items ( )

pagination() protected method

Display the pagination.
protected pagination ( $which )

prepare_items() abstract public method

Prepares the list of items for displaying.
abstract public prepare_items ( )

print_column_headers() protected method

Print column headers, accounting for hidden and sortable columns.
protected print_column_headers ( boolean $with_id = true )
$with_id boolean

row_actions() protected method

Generate row actions div
protected row_actions ( array $actions, boolean $always_visible = false ) : string
$actions array
$always_visible boolean
return string

set_pagination_args() protected method

An internal method that sets all the necessary pagination arguments.
protected set_pagination_args ( array $args )
$args array

single_row() protected method

Generates content for a single row of the table.
protected single_row ( object $item )
$item object The current item

single_row_columns() protected method

Generates the columns for a single row of the table.
protected single_row_columns ( object $item )
$item object The current item

view_switcher() protected method

Display a view switcher
protected view_switcher ( $current_mode )

views() public method

Display the list of views available on this table.
public views ( )

Property Details

$actions protected_oe property

protected array $actions
return array

$args protected_oe property

protected array $args
return array

$items protected_oe property

protected array $items
return array

$pagination protected_oe property

protected string $pagination
return string

$pagination_args protected_oe property

protected array $pagination_args
return array

$screen protected_oe property

protected object $screen
return object