Documentation

MLA_Template_List_Table extends WP_List_Table

Class MLA (Media Library Assistant) Template List Table displays the shortcode templates submenu table

Extends the core WP_List_Table class.

Tags
since
2.40

Table of Contents

Properties

$default_columns  : array<string|int, mixed>
Table column definitions
$default_hidden_columns  : array<string|int, mixed>
Default values for hidden columns
$default_sortable_columns  : array<string|int, mixed>
Sortable column definitions

Methods

__construct()  : void
Calls the parent constructor to set some default values.
_get_view()  : string|false
Returns HTML markup for one view that can be used with this table
column_cb()  : string
Displays checkboxes for using bulk actions. The 'cb' column is given special treatment when columns are processed.
column_default()  : string
Supply a column value if no column-specific function has been defined
column_description()  : string
Supply the content for the Description column
column_name()  : string
Supply the content for the Name column
column_shortcode()  : string
Supply the content for the Shortcode column
column_type()  : string
Supply the content for the Type column
extra_tablenav()  : void
Extra controls to be displayed between bulk actions and pagination
get_bulk_actions()  : array<string|int, mixed>
Get an associative array ( option_name => option_title ) with the list of bulk actions available on this table.
get_columns()  : array<string|int, mixed>
This method dictates the table's columns and titles
get_hidden_columns()  : array<string|int, mixed>
Returns the list of currently hidden columns from a user option or from default values if the option is not set
get_sortable_columns()  : array<string|int, mixed>
Returns an array where the key is the column that needs to be sortable and the value is db column to sort by.
get_views()  : array<string|int, mixed>
Returns an associative array listing all the views that can be used with this table.
mla_admin_init()  : void
Called in the admin_init action because the list_table object isn't created in time to affect the "screen options" setup.
mla_admin_print_styles_action()  : mixed
Print optional in-line styles for the Shortcodes submenu table
mla_get_sortable_columns()  : array<string|int, mixed>
Return the names and orderby values of the sortable columns
mla_get_template_status_dropdown()  : string
Get dropdown box of template status values, i.e., Default/Custom.
mla_manage_columns_filter()  : array<string|int, mixed>
Handler for filter 'manage_settings_page_mla-settings-menu_columns'
mla_manage_hidden_columns_filter()  : array<string|int, mixed>
Handler for filter 'get_user_option_managesettings_page_mla-settings-menu-shortcodescolumnshidden'
mla_submenu_arguments()  : array<string|int, mixed>
Process $_REQUEST, building $submenu_arguments
pagination()  : mixed
Display the pagination, adding view, search and filter arguments
prepare_items()  : void
Prepares the list of items for displaying
print_column_headers()  : mixed
Print column headers, adding view, search and filter arguments
single_row()  : void
Generates (echoes) content for a single row of the table
get_default_primary_column_name()  : string
Get the name of the default primary column.
_build_rollover_actions()  : array<string|int, mixed>
Add rollover actions to a table column
_default_hidden_columns()  : array<string|int, mixed>
Access the default list of hidden columns
_localize_default_columns_array()  : mixed
Builds the $default_columns array with translated source texts.

Properties

$default_columns

Table column definitions

private static array<string|int, mixed> $default_columns = array()

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_Template_List_Table::_localize_default_columns_array.

{ @type string $$column_slug Column title. }

Tags
since
2.40
access

private

$default_hidden_columns

Default values for hidden columns

private static array<string|int, mixed> $default_hidden_columns = array()

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').

{ @type string $$index Column slug. }

Tags
since
2.40
access

private

$default_sortable_columns

Sortable column definitions

private static array<string|int, mixed> $default_sortable_columns = array('name' => array('name', \false), 'type' => array('type', \false), 'shortcode' => array('shortcode', \false), 'description' => array('description', \false))

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.

{ @type array $$column_slug { @type string $orderby_name Database column or other sorting slug. @type boolean $descending Optional. True to make the initial orderby DESC. } }

Tags
since
2.40
access

private

Methods

_get_view()

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

public _get_view(mixed $view_slug, mixed $template_item, mixed $current_view) : string|false
Parameters
$view_slug : mixed
$template_item : mixed
$current_view : mixed
Tags
since
2.40
Return values
string|false

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

column_cb()

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

public column_cb(mixed $item) : string
Parameters
$item : mixed
Tags
since
2.40
Return values
string

HTML markup to be placed inside the column

column_default()

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

public column_default(mixed $item, mixed $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.

Parameters
$item : mixed
$column_name : mixed
Tags
since
2.40
Return values
string

Text or HTML to be placed inside the column

column_description()

Supply the content for the Description column

public column_description(mixed $item) : string
Parameters
$item : mixed
Tags
since
2.40
Return values
string

HTML markup to be placed inside the column

column_name()

Supply the content for the Name column

public column_name(mixed $item) : string
Parameters
$item : mixed
Tags
since
2.40
Return values
string

HTML markup to be placed inside the column

column_shortcode()

Supply the content for the Shortcode column

public column_shortcode(mixed $item) : string
Parameters
$item : mixed
Tags
since
2.40
Return values
string

HTML markup to be placed inside the column

column_type()

Supply the content for the Type column

public column_type(mixed $item) : string
Parameters
$item : mixed
Tags
since
2.40
Return values
string

HTML markup to be placed inside the column

extra_tablenav()

Extra controls to be displayed between bulk actions and pagination

public extra_tablenav(mixed $which) : void

Modeled after class-wp-posts-list-table.php in wp-admin/includes.

Parameters
$which : mixed
Tags
since
2.40

get_bulk_actions()

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

public get_bulk_actions() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

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

get_columns()

This method dictates the table's columns and titles

public get_columns() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

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

get_hidden_columns()

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

public get_hidden_columns() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

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

get_sortable_columns()

Returns an array where the key is the column that needs to be sortable and the value is db column to sort by.

public get_sortable_columns() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

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

get_views()

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

public get_views() : array<string|int, mixed>

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

Tags
since
2.40
Return values
array<string|int, mixed>

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

mla_admin_init()

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

public static mla_admin_init() : void
Tags
since
2.40

mla_admin_print_styles_action()

Print optional in-line styles for the Shortcodes submenu table

public static mla_admin_print_styles_action() : mixed
Tags
since
2.40

mla_get_sortable_columns()

Return the names and orderby values of the sortable columns

public static mla_get_sortable_columns() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

column_slug => array( orderby value, initial_descending_sort ) for sortable columns

mla_get_template_status_dropdown()

Get dropdown box of template status values, i.e., Default/Custom.

public static mla_get_template_status_dropdown([string $selected = 'any' ]) : string
Parameters
$selected : string = 'any'

Optional. Currently selected status. Default 'any'.

Tags
since
2.40
Return values
string

HTML markup for dropdown box.

mla_manage_columns_filter()

Handler for filter 'manage_settings_page_mla-settings-menu_columns'

public static mla_manage_columns_filter() : array<string|int, mixed>

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.

Tags
since
2.40
Return values
array<string|int, mixed>

list of table columns

mla_manage_hidden_columns_filter()

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

public static mla_manage_hidden_columns_filter(mixed $result, mixed $option, mixed $user_data) : array<string|int, mixed>

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.

Parameters
$result : mixed
$option : mixed
$user_data : mixed
Tags
since
2.40
Return values
array<string|int, mixed>

updated list of hidden columns

mla_submenu_arguments()

Process $_REQUEST, building $submenu_arguments

public static mla_submenu_arguments([bool $include_filters = true ]) : array<string|int, mixed>
Parameters
$include_filters : bool = true

Optional. Include the "click filter" values in the results. Default true.

Tags
since
2.40
Return values
array<string|int, mixed>

non-empty view, search, filter and sort arguments

pagination()

Display the pagination, adding view, search and filter arguments

public pagination(mixed $which) : mixed
Parameters
$which : mixed
Tags
since
2.40

prepare_items()

Prepares the list of items for displaying

public 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().

Tags
since
2.40

print_column_headers()

Print column headers, adding view, search and filter arguments

public print_column_headers([bool $with_id = true ]) : mixed
Parameters
$with_id : bool = true

Whether to set the id attribute or not

Tags
since
2.40

single_row()

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

public single_row(mixed $item) : void
Parameters
$item : mixed
Tags
since
2.40
Return values
void

Echoes the row HTML

get_default_primary_column_name()

Get the name of the default primary column.

protected get_default_primary_column_name() : string
Tags
since
2.40
access

protected

Return values
string

Name of the default primary column

_build_rollover_actions()

Add rollover actions to a table column

private _build_rollover_actions(mixed $item, mixed $column) : array<string|int, mixed>
Parameters
$item : mixed
$column : mixed
Tags
since
2.40
Return values
array<string|int, mixed>

Names and URLs of row-level actions

_default_hidden_columns()

Access the default list of hidden columns

private static _default_hidden_columns() : array<string|int, mixed>
Tags
since
2.40
Return values
array<string|int, mixed>

default list of hidden columns

_localize_default_columns_array()

Builds the $default_columns array with translated source texts.

private static _localize_default_columns_array() : mixed
Tags
since
2.40

        
On this page

Search results