Class MLA (Media Library Assistant) List Table implements the "Assistant" admin submenu

Extends the core WP_List_Table class.

package Media Library Assistant
since 0.1

 Methods

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

__construct() 

since 0.1

Checks the current user's permissions

ajax_user_can() : bool

since 2.13

Returns

bool

Supply the content for a custom column

column_ID_parent(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_alt_text(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_attached_to(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_author(array $item) : string

since 0.30

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_base_file(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_caption(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Displays checkboxes for using bulk actions.

column_cb(array $item) : string

The 'cb' column is given special treatment when columns are processed.

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_date(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

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

column_default(array $item, array $column_name) : string

Called when the parent class can't find a method specifically built for a given column. The taxonomy and custom field columns are handled here. All other columns should have a specific method, so this function returns a troubleshooting message.

since 0.1

Parameters

$item

array

A singular item (one full row's worth of data)

$column_name

array

The name/slug of the column to be processed

Returns

stringText or HTML to be placed inside the column

Supply the content for a custom column

column_description(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_file_url(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_galleries(array $item) : string

since 0.70

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_icon(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_inserted(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_menu_order(array $item) : string

since 0.60

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_mla_galleries(array $item) : string

since 0.70

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_modified(array $item) : string

since 0.30

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_parent(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_post_mime_type(array $item) : string

since 0.30

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_post_name(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_post_title(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Supply the content for a custom column

column_title_name(array $item) : string

since 0.1

Parameters

$item

array

A singular attachment (post) object

Returns

stringHTML markup to be placed inside the column

Generate the table navigation above or below the table

display_tablenav(string $which) 

Adds the list/grid switcher in WP 4.0+

since 2.25

Parameters

$which

string

'top' or 'bottom', i.e., above or below the table rows

Extra controls to be displayed between bulk actions and pagination

extra_tablenav(string $which) : void

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

since 0.1

Parameters

$which

string

'top' or 'bottom', i.e., above or below the table rows

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

get_bulk_actions() : array

since 0.1

Returns

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

This method dictates the table's columns and titles

get_columns() : array

since 0.1

Returns

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

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 0.1

Returns

arrayColumn 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 (or other criteria) to sort by.

get_sortable_columns() : array

since 0.1

Returns

arraySortable column information,e.g., 'slug' => array('data_value', (boolean) initial_descending )

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 0.1

Returns

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

Adds support for taxonomy and custom field columns

mla_admin_init_action() 

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

since 0.30

Get dropdown box of terms to filter by, if available

mla_get_taxonomy_filter_dropdown(integer $selected, array $dropdown_options) : string

since 1.20

Parameters

$selected

integer

currently selected term_id || zero (default)

$dropdown_options

array

additional wp_dropdown_categories options; default empty

Returns

stringHTML markup for dropdown box

Wrapper for _get_view; returns HTML markup for one view that can be used with this table

mla_get_view(string $view_slug, string $current_view) : string

since 2.11

Parameters

$view_slug

string

View slug, key to MLA_POST_MIME_TYPES array

$current_view

string

Slug for current view

Returns

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

Handler for filter 'manage_media_page_mla-menu_columns'

mla_manage_columns_filter() : array

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 0.1

Returns

arraylist of table columns

Handler for filter 'get_user_option_managemedia_page_mla-menucolumnshidden'

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

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 0.1

Parameters

$result

string

current list of hidden columns, if any

$option

string

'managemedia_page_mla-menucolumnshidden'

$user_data

object

WP_User object, if logged in

Returns

arrayupdated list of hidden columns

Process $_REQUEST, building $submenu_arguments

mla_submenu_arguments(boolean $include_filters) : array

since 1.42

Parameters

$include_filters

boolean

Optional: Include the "click filter" values in the results

Returns

arraynon-empty view, search, filter and sort arguments

Prepares the list of items for displaying

prepare_items() 

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 0.1

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

single_row(object $item) : void

since .20

Parameters

$item

object

the current item

Get MIME types with one or more attachments for view preparation

_avail_mime_types(array $num_posts) : array

Modeled after get_available_post_mime_types in wp-admin/includes/post.php, but uses the output of wp_count_attachments() as input.

since 0.1

Parameters

$num_posts

array

Number of posts for each MIME type

Returns

arrayMime type names

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

_build_inline_data(object $item) : string

since 0.20

Parameters

$item

object

A singular attachment (post) object

Returns

stringHTML
with row data

Generate item thumbnail image tag

_build_item_thumbnail(object $item) : string

since 2.15

Parameters

$item

object

A singular attachment (post) object

Returns

stringHTML for thumbnail

Add rollover actions to the current primary column, one of: 'ID_parent', 'title_name', 'post_title', 'post_name'

_build_rollover_actions(object $item, string $column) : array

since 0.1

Parameters

$item

object

A singular attachment (post) object

$column

string

Current column name

Returns

arrayNames and URLs of row-level actions

Translate post_status 'future', 'pending', 'draft' and 'trash' to label

_format_post_status(string $post_status) : string

since 2.01

Parameters

$post_status

string

post_status

Returns

stringStatus label or empty string

Format primary column before/after Wordpress v4.3

_handle_primary_column(object $item, string $column_name, string $column_content) : string

For WordPress before 4.3, add rollover actions and inline_data to the first visible column. For 4.3 and later, merge the icon with the primary visible column and add div tags.

since 2.13

Parameters

$item

object

A singular attachment (post) object

$column_name

string

Current column name

$column_content

string

Current column contents

Returns

stringComplete column content

Get the name of the default primary column.

get_default_primary_column_name() : string

since 2.13
access protected

Returns

stringName of the default primary column

Generate and display row actions links.

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

since 2.13
access protected

Parameters

$item

object

Attachment being acted upon.

$column_name

string

Current column name.

$primary

string

Primary column name.

Returns

stringRow actions output for media attachments.

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

_get_view(string $view_slug, string $current_view) : string

since 1.40

Parameters

$view_slug

string

View slug, key to MLA_POST_MIME_TYPES array

$current_view

string

Slug for current view

Returns

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

 Properties

 

Currently hidden columns

$currently_hidden : array

Records hidden columns so row-level actions are not assigned to them.

since 0.1
 

Table column definitions

$default_columns : array

since 0.1
 

Default values for hidden columns

$default_hidden_columns : array

since 0.1
 

Sortable column definitions

$default_sortable_columns : array

since 0.1
 

The WPML_List_table support object, if required

$mla_wpml_table : object

since 2.11
 

Records assignment of row-level actions to a table row

$rollover_id : int

Set to the current Post-ID when row-level actions are output for the row.

since 0.1
 

True if the current view is "Attached"

$attached : int

since 2.11
 

True if the current view is "Unattached"

$detached : int

Declaration added in MLA v2.11 for WP 4.2 compatibility.

since 0.1
 

True if the current view is "Trash"

$is_trash : int

Declaration added in MLA v2.11 for WP 4.2 compatibility.

since 0.1