\Barn2\Plugin\Posts_Table_ProPosts_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.

Summary

Methods
Properties
Constants
__construct()
get_table()
get_data()
update()
$id
$args
$query
$hooks
$data_table
CONTROL_COLUMN_DATA_SOURCE
No protected methods found
No protected properties found
N/A
fetch_data()
can_fetch_data()
add_posts_to_table()
add_post_data()
add_attributes()
add_headings()
add_heading()
get_row_attributes()
array_filter_empty_attribute()
json_encode_config()
$columns
$data_factory
$config_builder
$cache
$table_initialised
$data_added
N/A

Constants

CONTROL_COLUMN_DATA_SOURCE

CONTROL_COLUMN_DATA_SOURCE ='control'

Properties

$id

$id :

Type

$args

$args :

Type

$query

$query :

Type

$hooks

$hooks :

Type

$data_table

$data_table :

Type

$columns

$columns :

Type

$data_factory

$data_factory :

Type

$config_builder

$config_builder :

Type

$cache

$cache :

Type

$table_initialised

$table_initialised :

Type

$data_added

$data_added :

Type

Methods

__construct()

__construct(  $id,  $args = array())

Parameters

$id
$args

get_table()

get_table(string  $output = 'object'): object|array|string

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

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

string $output

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

Returns

object|array|string —

The posts table in the requested format.

get_data()

get_data(  $output = 'object'): object|array|string

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

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

Returns

object|array|string —

The posts table data in the requested format.

update()

update(array  $new_args)

Parameters

array $new_args

fetch_data()

fetch_data()

can_fetch_data()

can_fetch_data()

add_posts_to_table()

add_posts_to_table(  $posts)

Parameters

$posts

add_post_data()

add_post_data(  $column,  $key,  $post)

Parameters

$column
$key
$post

add_attributes()

add_attributes()

add_headings()

add_headings()

add_heading()

add_heading(  $heading,  $attributes,  $key)

Parameters

$heading
$attributes
$key

get_row_attributes()

get_row_attributes(  $post)

Parameters

$post

array_filter_empty_attribute()

array_filter_empty_attribute(  $value)

Parameters

$value

json_encode_config()

json_encode_config(  $config)

Parameters

$config