Product_Table
Represents a table of WooCommerce products.
This class is responsible for creating the table from the specified parameter and returning the complete table as a Html_Data_Table instance.
The main functions provided are get_table() and get_data().
Tags
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 products based on the specified arguments.
- get_table() : object|array<string|int, mixed>|string
- Retrieves the data table containing the list of products based on the arguments supplied on construction.
- update() : mixed
- Update the table with new arguments specified in $args. Previously posts data is preserved where possible, to prevent additional DB calls.
- add_attributes() : mixed
- add_heading() : mixed
- add_headings() : mixed
- add_product_data() : mixed
- add_products_to_table() : mixed
- Add the products (array of post objects) to the table.
- append_bulk_select_checkbox() : mixed
- array_filter_empty_attribute() : mixed
- can_fetch_data() : mixed
- fetch_data() : mixed
- get_row_attributes() : mixed
- json_encode_config() : mixed
- setup_postdata_for_product() : mixed
Constants
CONTROL_COLUMN_DATA_SOURCE
public
mixed
CONTROL_COLUMN_DATA_SOURCE
= 'control'
Properties
$args
public
mixed
$args
$data_table
public
mixed
$data_table
$hooks
public
mixed
$hooks
$id
public
mixed
$id
$query
public
mixed
$query
$cache
private
mixed
$cache
$columns
private
mixed
$columns
$config_builder
private
mixed
$config_builder
$data_added
private
mixed
$data_added
= false
$data_factory
private
mixed
$data_factory
$table_initialised
private
mixed
$table_initialised
= false
Methods
__construct()
public
__construct(mixed $id[, array<string|int, mixed> $args = [] ]) : mixed
Parameters
- $id : mixed
- $args : array<string|int, mixed> = []
Return values
mixed —get_data()
Retrieves the data table containing the list of products based on the specified arguments.
public
get_data([string $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
Parameters
- $output : string = 'object'
-
The output type (see description).
Return values
object|array<string|int, mixed>|string —The product table data in the requested format.
get_table()
Retrieves the data table containing the list of products 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