-
Notifications
You must be signed in to change notification settings - Fork 0
WP_List_Table
Base class for displaying a list of items in an ajaxified HTML table.
- Full name:
\CourierNotices\Helper\WP_List_Table
The current list of items.
public array $items
Various information about the current table.
protected array $_args
Various information needed for displaying the pagination.
protected array $_pagination_args
The current screen.
protected object $screen
Cached bulk actions.
private array $_actions
Cached pagination output.
private string $_pagination
The view switcher modes.
protected array $modes
Stores the value returned by ->get_column_info().
protected array $_column_headers
{@internal Missing Summary}
protected array $compat_fields
{@internal Missing Summary}
protected array $compat_methods
Constructor.
public __construct(array|string $args = array()): mixed
The child class should call this constructor from its own constructor to override the default $args.
Parameters:
Parameter | Type | Description |
---|---|---|
$args |
array|string | { Array or string of arguments. @type string $plural Plural value used for labels and the objects being listed. This affects things such as CSS class-names and nonces used in the list table, e.g. 'posts'. Default empty. @type string $singular Singular label for an object being listed, e.g. 'post'. Default empty @type bool $ajax Whether the list table supports Ajax. This includes loading and sorting data, for example. If true, the class will call the _js_vars() method in the footer to provide variables to any scripts handling Ajax events. Default false. @type string $screen String containing the hook name used to determine the current screen. If left null, the current screen will be automatically set. Default null. } |
Make private properties readable for backward compatibility.
public __get(string $name): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Property to get. |
Return Value:
Property.
Make private properties settable for backward compatibility.
public __set(string $name, mixed $value): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Property to check if set. |
$value |
mixed | Property value. |
Return Value:
Newly-set property.
Make private properties checkable for backward compatibility.
public __isset(string $name): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Property to check if set. |
Return Value:
Whether the property is set.
Make private properties un-settable for backward compatibility.
public __unset(string $name): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Property to unset. |
Make private/protected methods readable for backward compatibility.
public __call(string $name, array $arguments): mixed|bool
Parameters:
Parameter | Type | Description |
---|---|---|
$name |
string | Method to call. |
$arguments |
array | Arguments to pass when calling. |
Return Value:
Return value of the callback, false otherwise.
Checks the current user's permissions
public ajax_user_can(): mixed
Prepares the list of items for displaying.
public prepare_items(): mixed
An internal method that sets all the necessary pagination arguments
protected set_pagination_args(array|string $args): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$args |
array|string | Array or string of arguments with information about the pagination. |
Access the pagination args.
public get_pagination_arg(string $key): int
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string | Pagination argument to retrieve. Common values include 'total_items', 'total_pages', 'per_page', or 'infinite_scroll'. |
Return Value:
Number of items that correspond to the given pagination argument.
Whether the table has items to display or not
public has_items(): bool
Message to be displayed when there are no items
public no_items(): mixed
Displays the search box.
public search_box(string $text, string $input_id): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$text |
string | The 'submit' button label. |
$input_id |
string | ID attribute value for the search input field. |
Get an associative array ( id => link ) with the list of views available on this table.
protected get_views(): array
Display the list of views available on this table.
public views(): mixed
Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table.
protected get_bulk_actions(): array
Display the bulk actions dropdown.
protected bulk_actions(string $which = ''): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$which |
string | The location of the bulk actions: 'top' or 'bottom'. This is designated as optional for backward compatibility. |
Get the current action selected from the bulk actions dropdown.
public current_action(): string|false
Return Value:
The action name or False if no action was selected
Generate row actions div
protected row_actions(string[] $actions, bool $always_visible = false): string
Parameters:
Parameter | Type | Description |
---|---|---|
$actions |
string[] | An array of action links. |
$always_visible |
bool | Whether the actions should be always visible. |
Display a monthly dropdown for filtering items
protected months_dropdown(string $post_type): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$post_type |
string |
Display a view switcher
protected view_switcher(string $current_mode): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$current_mode |
string |
Display a comment count bubble
protected comments_bubble(int $post_id, int $pending_comments): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$post_id |
int | The post ID. |
$pending_comments |
int | Number of pending comments. |
Get the current page number
public get_pagenum(): int
Get number of items to display on a single page
protected get_items_per_page(string $option, int $default = 20): int
Parameters:
Parameter | Type | Description |
---|---|---|
$option |
string | |
$default |
int |
Display the pagination.
protected pagination(string $which): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$which |
string |
Get a list of columns. The format is: 'internal-name' => 'Title'
public get_columns(): array
Get a list of sortable columns. The format is: 'internal-name' => 'orderby' or 'internal-name' => array( 'orderby', true )
protected get_sortable_columns(): array
The second format will make the initial sorting order be descending
Gets the name of the default primary column.
protected get_default_primary_column_name(): string
Return Value:
Name of the default primary column, in this case, an empty string.
Public wrapper for WP_List_Table::get_default_primary_column_name().
public get_primary_column(): string
Return Value:
Name of the default primary column.
Gets the name of the primary column.
protected get_primary_column_name(): string
Return Value:
The name of the primary column.
Get a list of all, hidden and sortable columns, with filter applied
protected get_column_info(): array
Return number of visible columns
public get_column_count(): int
Print column headers, accounting for hidden and sortable columns.
public print_column_headers(bool $with_id = true): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$with_id |
bool | Whether to set the id attribute or not |
Display the table
public display(): mixed
Get a list of CSS classes for the WP_List_Table table tag.
protected get_table_classes(): array
Return Value:
List of CSS classes for the table tag.
Generate the table navigation above or below the table
protected display_tablenav(string $which): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$which |
string |
Extra controls to be displayed between bulk actions and pagination
protected extra_tablenav(string $which): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$which |
string |
Generate the tbody element for the list table.
public display_rows_or_placeholder(): mixed
Generate the table rows
public display_rows(): mixed
Generates content for a single row of the table
public single_row(object $item): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$item |
object | The current item |
protected column_default(object $item, string $column_name): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$item |
object | |
$column_name |
string |
protected column_cb(object $item): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$item |
object |
Generates the columns for a single row of the table
protected single_row_columns(object $item): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$item |
object | The current item |
Generates and display row actions links for the list table.
protected handle_row_actions(object $item, string $column_name, string $primary): string
Parameters:
Parameter | Type | Description |
---|---|---|
$item |
object | The item being acted upon. |
$column_name |
string | Current column name. |
$primary |
string | Primary column name. |
Return Value:
The row actions HTML, or an empty string if the current column is the primary column.
Handle an incoming ajax request (called from admin-ajax.php)
public ajax_response(): mixed
Send required variables to JavaScript land
public _js_vars(): mixed
Automatically generated on 2024-08-26