\TGMPA_List_Table

List table class for handling plugins.

Extends the WP_List_Table class to provide a future-compatible way of listing out all required/recommended plugins.

Gives users an interface similar to the Plugin Administration area with similar (albeit stripped down) capabilities.

This class also allows for the bulk install of plugins.

Summary

Methods
Properties
Constants
__construct()
get_table_classes()
sort_table_items()
get_views()
column_default()
column_cb()
column_plugin()
column_version()
no_items()
get_columns()
single_row()
wp_plugin_update_row()
extra_tablenav()
get_bulk_actions()
process_bulk_actions()
prepare_items()
$view_context
No constants found
_gather_plugin_data()
categorize_plugins_to_views()
set_view_totals()
get_plugin_advise_type_text()
get_plugin_source_type_text()
get_plugin_status_text()
get_default_primary_column_name()
get_primary_column_name()
get_row_actions()
_get_plugin_data_from_name()
$tgmpa
$view_totals
N/A
No private methods found
No private properties found
N/A

Properties

$view_context

$view_context : string

The currently chosen view.

Type

string — One of: 'all', 'install', 'update', 'activate'

$tgmpa

$tgmpa : object

TGMPA instance.

Type

object

$view_totals

$view_totals : array

The plugin counts for the various views.

Type

array

Methods

__construct()

__construct()

References parent constructor and sets defaults for class.

get_table_classes()

get_table_classes() : array

Get a list of CSS classes for the <table> tag.

Overruled to prevent the 'plural' argument from being added.

Returns

array —

CSS classnames.

sort_table_items()

sort_table_items(array $items) : array

Sort plugins by Required/Recommended type and by alphabetical plugin name within each type.

Parameters

array $items

Prepared table items.

Returns

array —

Sorted table items.

get_views()

get_views() : array

Get an associative array ( id => link ) of the views available on this table.

Returns

array

column_default()

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

Create default columns to display important plugin information like type, action and status.

Parameters

array $item

Array of item data.

string $column_name

The name of the column.

Returns

string

column_cb()

column_cb(array $item) : string

Required for bulk installing.

Adds a checkbox for each plugin.

Parameters

array $item

Array of item data.

Returns

string —

The input checkbox with all necessary info.

column_plugin()

column_plugin(array $item) : string

Create default title column along with the action links.

Parameters

array $item

Array of item data.

Returns

string —

The plugin name and action links.

column_version()

column_version(array $item) : string

Create version information column.

Parameters

array $item

Array of item data.

Returns

string —

HTML-formatted version information.

no_items()

no_items()

Sets default message within the plugins table if no plugins are left for interaction.

Hides the menu item to prevent the user from clicking and getting a permissions error.

get_columns()

get_columns() : array

Output all the column information within the table.

Returns

array —

$columns The column names.

single_row()

single_row(object $item)

Generates content for a single row of the table.

Parameters

object $item

The current item.

wp_plugin_update_row()

wp_plugin_update_row(string $slug, array $item) : null

Show the upgrade notice below a plugin row if there is one.

Parameters

string $slug

Plugin slug.

array $item

The information available in this table row.

Returns

null —

Return early if upgrade notice is empty.

extra_tablenav()

extra_tablenav(string $which)

Extra controls to be displayed between bulk actions and pagination.

Parameters

string $which

'top' or 'bottom' table navigation.

get_bulk_actions()

get_bulk_actions() : array

Defines the bulk actions for handling registered plugins.

Returns

array —

$actions The bulk actions for the plugin install table.

process_bulk_actions()

process_bulk_actions()

Processes bulk installation and activation actions.

The bulk installation process looks for the $_POST information and passes that through if a user has to use WP_Filesystem to enter their credentials.

prepare_items()

prepare_items()

Prepares all of our information to be outputted into a usable table.

_gather_plugin_data()

_gather_plugin_data() : array

Gathers and renames all of our plugin information to be used by WP_List_Table to create our table.

Returns

array —

$table_data Information for use in table.

categorize_plugins_to_views()

categorize_plugins_to_views()

Categorize the plugins which have open actions into views for the TGMPA page.

set_view_totals()

set_view_totals(array $plugins)

Set the counts for the view links.

Parameters

array $plugins

Plugins order by view.

get_plugin_advise_type_text()

get_plugin_advise_type_text(string $required) : string

Get the plugin required/recommended text string.

Parameters

string $required

Plugin required setting.

Returns

string

get_plugin_source_type_text()

get_plugin_source_type_text(string $type) : string

Get the plugin source type text string.

Parameters

string $type

Plugin type.

Returns

string

get_plugin_status_text()

get_plugin_status_text(string $slug) : string

Determine the plugin status message.

Parameters

string $slug

Plugin slug.

Returns

string

get_default_primary_column_name()

get_default_primary_column_name() : string

Get name of default primary column

Returns

string

get_primary_column_name()

get_primary_column_name() : string

Get the name of the primary column.

Returns

string —

The name of the primary column.

get_row_actions()

get_row_actions(array $item) : array

Get the actions which are relevant for a specific plugin row.

Parameters

array $item

Array of item data.

Returns

array —

Array with relevant action links.

_get_plugin_data_from_name()

_get_plugin_data_from_name(string $name, string $data) : string|boolean

Retrieve plugin data, given the plugin name.

Parameters

string $name

Name of the plugin, as it was registered.

string $data

Optional. Array key of plugin data to return. Default is slug.

Returns

string|boolean —

Plugin slug if found, false otherwise.