Posts_Table

Represents a data table of WP_Post objects.

This class is responsible for creating the table from the supplied args and returning it as a Html_Data_Table object.

Tags
author

Barn2 Plugins [email protected]

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

CONTROL_COLUMN_DATA_SOURCE  = 'control'
$args  : mixed
$data_table  : mixed
$hooks  : mixed
$id  : mixed
$query  : mixed
$cache  : mixed
$columns  : mixed
$config_builder  : mixed
$data_added  : mixed
$data_factory  : mixed
$table_initialised  : mixed
__construct()  : mixed
get_data()  : object|array<string|int, mixed>|string
Retrieves the data table containing the list of posts based on the specified arguments.
get_table()  : object|array<string|int, mixed>|string
Retrieves the data table containing the list of posts based on the arguments supplied on construction.
update()  : mixed
add_attributes()  : mixed
add_heading()  : mixed
add_headings()  : mixed
add_post_data()  : mixed
add_posts_to_table()  : mixed
array_filter_empty_attribute()  : mixed
can_fetch_data()  : mixed
fetch_data()  : mixed
get_row_attributes()  : mixed
json_encode_config()  : mixed

Constants

CONTROL_COLUMN_DATA_SOURCE

public mixed CONTROL_COLUMN_DATA_SOURCE = 'control'
Tags

Properties

$table_initialised

private mixed $table_initialised = false
Tags

Methods

__construct()

public __construct(mixed $id[, mixed $args = [] ]) : mixed
Parameters
$id : mixed
$args : mixed = []
Tags
Return values
mixed —

get_data()

Retrieves the data table containing the list of posts based on the specified arguments.

public get_data([mixed $output = 'object' ]) : object|array<string|int, mixed>|string

The table returned includes only the table data itself (i.e. the rows), and doesn't include the header, footer, etc.

If the output is 'object' the returned object will be an Html_Data_Table instance. If the output is 'html', the data returned will be a string containing a list of elements, one for each product found. If the output is 'array', the data returned will be an array of rows, one for each product found. if the output is 'json', the data returned will be a JSON-encoded string in the same format as 'array'.

Parameters
$output : mixed = 'object'
Tags
Return values
object|array<string|int, mixed>|string —

The posts table data in the requested format.

get_table()

Retrieves the data table containing the list of posts based on the arguments supplied on construction.

public get_table([string $output = 'object' ]) : object|array<string|int, mixed>|string

The table returned includes the table headings, attributes and data.

If the output is 'object' the returned object is an Html_Data_Table instance. If the output is 'html', the table returned will be a string containing the

element at its root, and include the , and elements. If the output is 'array', the table returned will be an array containing the following keys: 'thead', 'tbody', 'tfoot' and 'attributes'. If the output is 'json', the return value will be a JSON-encoded string in the same format as 'array'.

Parameters
$output : string = 'object'

The output format - object, html, array or json. Default 'object'.

Tags
Return values
object|array<string|int, mixed>|string —

The posts table in the requested format.

update()

public update(array<string|int, mixed> $args) : mixed
Parameters
$args : array<string|int, mixed>
Tags
Return values
mixed —

add_attributes()

private add_attributes() : mixed
Tags
Return values
mixed —

add_heading()

private add_heading(mixed $heading, mixed $attributes, mixed $key) : mixed
Parameters
$heading : mixed
$attributes : mixed
$key : mixed
Tags
Return values
mixed —

add_headings()

private add_headings() : mixed
Tags
Return values
mixed —

add_post_data()

private add_post_data(mixed $column, mixed $key, mixed $post) : mixed
Parameters
$column : mixed
$key : mixed
$post : mixed
Tags
Return values
mixed —

add_posts_to_table()

private add_posts_to_table(mixed $posts) : mixed
Parameters
$posts : mixed
Tags
Return values
mixed —

array_filter_empty_attribute()

private static array_filter_empty_attribute(mixed $value) : mixed
Parameters
$value : mixed
Tags
Return values
mixed —

can_fetch_data()

private can_fetch_data() : mixed
Tags
Return values
mixed —

fetch_data()

private fetch_data() : mixed
Tags
Return values
mixed —

get_row_attributes()

private get_row_attributes(mixed $post) : mixed
Parameters
$post : mixed
Tags
Return values
mixed —

json_encode_config()

private static json_encode_config(mixed $config) : mixed
Parameters
$config : mixed
Tags
Return values
mixed —

Search results