Properties

$default_columns

$default_columns : array

Table column definitions

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_View_List_Table::mla_admin_init_action.

Type

array

$default_hidden_columns

$default_hidden_columns : array

Default values for hidden columns

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

array

$default_sortable_columns

$default_sortable_columns : array

Sortable column definitions

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 data is currently sorted by that column. This is computed each time the table is displayed.

Type

array

Methods

mla_get_sortable_columns()

mla_get_sortable_columns() : array

Return the names and display values of the sortable columns

Returns

array —

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

mla_manage_hidden_columns_filter()

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

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

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
$option
$user_data

Returns

array —

updated list of hidden columns

mla_manage_columns_filter()

mla_manage_columns_filter() : array

Handler for filter 'manage_settings_page_mla-settings-menu_columns'

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.

Returns

array —

list of table columns

mla_localize_default_columns_array()

mla_localize_default_columns_array() : void

Builds the $default_columns array with translated source texts.

Called from MLATest::initialize because the $default_columns information might be accessed from "front end" posts/pages.

mla_admin_init_action()

mla_admin_init_action() : void

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

__construct()

__construct() : void

Initializes some properties from $_REQUEST variables, then calls the parent constructor to set some default configs.

ajax_user_can()

ajax_user_can() : boolean

Checks the current user's permissions

Returns

boolean

column_default()

column_default(  $item,   $column_name) : string

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

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
$column_name

Returns

string —

Text or HTML to be placed inside the column

column_cb()

column_cb(  $item) : string

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

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_name()

column_name(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_specification()

column_specification(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_post_mime_type()

column_post_mime_type(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_table_view()

column_table_view(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_singular()

column_singular(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_plural()

column_plural(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_menu_order()

column_menu_order(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

column_description()

column_description(  $item) : string

Supply the content for a custom column

Parameters

$item

Returns

string —

HTML markup to be placed inside the column

get_columns()

get_columns() : array

This method dictates the table's columns and titles

Returns

array —

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

get_hidden_columns()

get_hidden_columns() : array

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

Returns

array —

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

get_sortable_columns()

get_sortable_columns() : array

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.

Returns

array —

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

get_bulk_actions()

get_bulk_actions() : array

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

Returns

array —

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

prepare_items()

prepare_items() : void

Prepares the list of items for displaying

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

single_row()

single_row(  $item) : void

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

Parameters

$item

get_default_primary_column_name()

get_default_primary_column_name() : string

Get the name of the default primary column.

Returns

string —

Name of the default primary column

handle_row_actions()

handle_row_actions(object  $item, string  $column_name, string  $primary) : string

Generate and display row actions links.

Parameters

object $item

Attachment being acted upon.

string $column_name

Current column name.

string $primary

Primary column name.

Returns

string —

Row actions output for media attachments.

_default_hidden_columns()

_default_hidden_columns() : array

Access the default list of hidden columns

Returns

array —

default list of hidden columns

_build_rollover_actions()

_build_rollover_actions(  $item,   $column) : array

Add rollover actions to a table column

Parameters

$item
$column

Returns

array —

Names and URLs of row-level actions

_build_inline_data()

_build_inline_data(  $item) : string

Add hidden fields with the data for use in the inline editor

Parameters

$item

Returns

string —

HTML

with row data