MLA_Example_List_Table

Extends \WP_List_Table

Class MLA (Media Library Assistant) Example List Table implements the searchable database of example plugins for the "Documentation" admin settings tab

Extends the core WP_List_Table class.

package

Media Library Assistant

since 2.32

Methods

Calls the parent constructor to set some default values.

__construct() : void
since 2.32

Add rollover actions to a table column

_build_rollover_actions( $item,  $column) : array
since 2.32

Arguments

$item

$column

Response

array

Names and URLs of row-level actions

Get the total number of MLA example_plugin objects

_count_example_items( $request) : integer
static
since 2.32

Arguments

$request

Response

integer

Number of MLA example_plugin objects

Access the default list of hidden columns

_default_hidden_columns() : array
static
since 2.32

Response

array

default list of hidden columns

Query the plugin_examples items

_execute_example_items_query( $request) : array
static
since 2.32

Arguments

$request

Response

array

query results; array of MLA post_mime_type objects

Assemble the in-memory representation of the Example Plugins

_get_example_plugin_items( $force_refresh = false) : boolean
static
since 2.32

Arguments

$force_refresh

Response

boolean

Success (true) or failure (false) of the operation

Returns HTML markup for one view that can be used with this table

_get_view( $view_slug,  $example_item,  $current_view) : string
since 2.32

Arguments

$view_slug

$example_item

$current_view

Response

string

| false HTML for link to display the view, false if count = zero

Builds the $default_columns array with translated source texts.

_localize_default_columns_array() : void
static
since 2.32

Sanitize and expand query arguments from request variables

_prepare_example_items_query( $raw_request,  $offset,  $count) : array
static
since 2.32

Arguments

$raw_request

$offset

$count

Response

array

revised arguments suitable for query

Install or update an Example Plugin

_process_example_plugin( $ID,  $update = false) : string
static
since 2.32

Arguments

$ID

$update

Response

string

empty or error message

Retrieve MLA example_plugin objects for list table display

_query_example_items( $request,  $offset,  $count) : array
static
since 2.32

Arguments

$request

$offset

$count

Response

array

MLA example_plugin objects

Callback to sort array by a 'Name' key.

_sort_uname_callback( $a,  $b) : integer
static
since 2.32

Arguments

$a

$b

Response

integer

The comparison result

Tabulate MLA example_plugin objects by view for list table display

_tabulate_example_items( $s = '') : array
static
since 2.32

Arguments

$s

Response

array

( 'singular' label, 'plural' label, 'count' of items )

Update an Example Plugin given its ID

_update_example_plugin( $ID,  $key,  $value) : boolean
static
since 2.32

Arguments

$ID

$key

$value

Response

boolean

true if object exists else false

Displays checkboxes for using bulk actions. The 'cb' column is given special treatment when columns are processed.

column_cb( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply a column value if no column-specific function has been defined

column_default( $item,  $column_name) : string

Called when the parent class can't find a method specifically built for a given column. All columns should have a specific method, so this function returns a troubleshooting message.

since 2.32

Arguments

$item

$column_name

Response

string

Text or HTML to be placed inside the column

Supply the content for the Description column

column_description( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply the content for the File Name column

column_file( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply the content for the Installed Version column

column_installed_version( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply the content for the Name column

column_name( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply the content for the Tags column

column_tags( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

Supply the content for the Version column

column_version( $item) : string
since 2.32

Arguments

$item

Response

string

HTML markup to be placed inside the column

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

get_bulk_actions() : array
since 2.32

Response

array

Contains all the bulk actions: 'slugs'=>'Visible Titles'

This method dictates the table's columns and titles

get_columns() : array
since 2.32

Response

array

Column information: 'slugs'=>'Visible Titles'

Get the name of the default primary column.

get_default_primary_column_name() : string
since 2.32
access

protected

Response

string

Name of the default primary column

Returns the list of currently hidden columns from a user option or from default values if the option is not set

get_hidden_columns() : array
since 2.32

Response

array

Column information,e.g., array(0 => 'ID_parent, 1 => 'title_name')

Returns an array where the key is the column that needs to be sortable and the value is db column to sort by. Also notes the current sort column, if set.

get_sortable_columns() : array
since 2.32

Response

array

Sortable column information,e.g., 'slugs'=>array('data_values',boolean)

Returns an associative array listing all the views that can be used with this table.

get_views() : array

These are listed across the top of the page and managed by WordPress.

since 2.32

Response

array

View information,e.g., array ( id => link )

Called in the admin_init action because the list_table object isn't created in time to affect the "screen options" setup.

mla_admin_init() : void
static
since 2.32

Print optional in-line styles for Example Plugins submenu table

mla_admin_print_styles_action() 
static
since 2.32

Find an Example Plugin given its ID

mla_find_example_plugin( $ID) : mixed
static
since 2.32

Arguments

$ID

Response

mixed

MLA example_plugin object if it exists else false

Return the names and display values of the sortable columns

mla_get_sortable_columns() : array
static
since 2.32

Response

array

name => array( orderby value, heading ) for sortable columns

Process an Example Plugin Install action

mla_install_example_plugin( $ID) : string
static
since 2.32

Arguments

$ID

Response

string

status/error messages

Handler for filter 'manage_settings_page_mla-settings-menu_columns'

mla_manage_columns_filter() : array
static

This required filter dictates the table's columns and titles. Set when the file is loaded because the list_table object isn't created in time to affect the "screen options" setup.

since 2.32

Response

array

list of table columns

Handler for filter 'get_user_option_managesettings_page_mla-settings-menu-examplecolumnshidden'

mla_manage_hidden_columns_filter( $result,  $option,  $user_data) : array
static

Required because the screen.php get_hidden_columns function only uses the get_user_option result. Set when the file is loaded because the object is not created in time for the call from screen.php.

since 2.32

Arguments

$result

$option

$user_data

Response

array

updated list of hidden columns

Process an Example Plugin Update action

mla_update_example_plugin( $ID) : string
static
since 2.32

Arguments

$ID

Response

string

status/error messages

Prepares the list of items for displaying

prepare_items() : void

This is where you prepare your data for display. This method will usually be used to query the database, sort and filter the data, and generally get it ready to be displayed. At a minimum, we should set $this->items and $this->set_pagination_args().

since 2.32

Generates (echoes) content for a single row of the table

single_row( $item) : void
since 2.32

Arguments

$item

Properties

Table column definitions

default_columns : array
static

This array defines table columns and titles where the key is the column slug (and class) and the value is the column's title text.

All of the columns are added to this array by MLA_Example_List_Table::_localize_default_columns_array.

since
var

Type(s)

array

Default values for hidden columns

default_hidden_columns : array
static

This array is used when the user-level option is not set, i.e., the user has not altered the selection of hidden columns.

The value on the right-hand side must match the column slug, e.g., array(0 => 'ID_parent, 1 => 'title_name').

since
var

Type(s)

array

Sortable column definitions

default_sortable_columns : array
static

This array defines the table columns that can be sorted. The array key is the column slug that needs to be sortable, and the value is database column to sort by. Often, the key and value will be the same, but this is not always the case (as the value is a column name from the database, not the list table).

The array value also contains a boolean which is 'true' if the initial sort order for the column is DESC/Descending.

since
var

Type(s)

array

In-memory representation of the Example Plugins

_example_plugin_items : array
static
since
var

ID => ( post_ID, name, version, description, file, tags )

Type(s)

array

Highest existing Post MIME Type ID value

_example_plugin_highest_ID : integer
static
since
var

Type(s)

integer