Table_Args

The Table_Args class is responsible for storing and validating the product table arguments.

It parses an array of args into their corresponding properties.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

$add_selected_button  : mixed
$ajax_cart  : mixed
$auto_width  : mixed
$button_text  : mixed
$cache  : mixed
$cart_button  : mixed
$category  : mixed
$cf  : mixed
$column_breakpoints  : mixed
$columns  : mixed
$date_columns  : mixed
$date_format  : mixed
$day  : mixed
$default_args  : array<string|int, mixed>
The full list of supported table options and their default values.
$description_length  : mixed
$exclude  : mixed
$exclude_category  : mixed
$filter_headings  : mixed
$filters  : mixed
$headings  : mixed
$image_size  : mixed
$include  : mixed
$lazy_load  : mixed
$lightbox  : mixed
$links  : mixed
$month  : mixed
$no_products_filtered_message  : mixed
$no_products_message  : mixed
$numeric_terms  : mixed
$offset  : mixed
$page_length  : mixed
$pagination  : mixed
$paging_type  : mixed
$priorities  : mixed
$product_limit  : mixed
$quantities  : mixed
$reset_button  : mixed
$responsive_control  : mixed
$responsive_display  : mixed
$rows_per_page  : mixed
$scroll_offset  : mixed
$search_box  : mixed
$search_filters  : mixed
$search_on_click  : mixed
$search_term  : mixed
$shortcodes  : mixed
$show_footer  : mixed
$show_hidden_columns  : mixed
$sort_by  : mixed
$sort_order  : mixed
$status  : mixed
$stock  : mixed
$tag  : mixed
$term  : mixed
$totals  : mixed
$user_products  : mixed
$user_search_term  : mixed
$variation_name_format  : mixed
$variations  : mixed
$widths  : mixed
$wrap  : mixed
$year  : mixed
$args  : array<string|int, mixed>
The args array.
$site_defaults  : array<string|int, mixed>
The site-wide table options after merging with the plugin settings.
__construct()  : mixed
Constructs a new table args object based on the supplied args. Args are validated and any missing args are merged in, and stored in the $args property.
__get()  : mixed
Magic __get method.
back_compat_args()  : array<string|int, mixed>
Maintain support for old arg names.
get_args()  : array<string|int, mixed>
Get the table args.
get_defaults()  : array<string|int, mixed>
Get the default table args based on the the options set in the plugin settings.
get_site_defaults()  : mixed
To work with the table builder.
get_table_defaults()  : mixed
Deprecated.
get_user_defaults()  : mixed
Deprecated.
is_multi_add_to_cart()  : bool
Is this table using the multi add to cart feature?
parse_columns_arg()  : mixed
Deprecated.
parse_filters_arg()  : mixed
Deprecated.
set_args()  : void
Set the table args. Not all args need to be supplied - new args will be merged in to the existing, and only those specified in the new args will be overwritten.
array_filter_custom_field_or_taxonomy()  : mixed
array_filter_taxonomy_or_attribute()  : mixed
array_filter_validate_boolean()  : mixed
parse_args()  : mixed
set_columns()  : mixed
set_filters()  : mixed
set_image_column_width()  : mixed
set_image_size()  : mixed

Properties

$add_selected_button

public mixed $add_selected_button

$column_breakpoints

public mixed $column_breakpoints

$default_args

The full list of supported table options and their default values.

public static array<string|int, mixed> $default_args = ['columns' => 'image,name,summary,price,buy', 'widths' => '', 'auto_width' => true, 'priorities' => '', 'column_breakpoints' => '', 'responsive_control' => 'inline', 'responsive_display' => 'child_row', 'wrap' => true, 'show_footer' => false, 'search_on_click' => true, 'filters' => true, 'quantities' => false, 'variations' => false, 'variation_name_format' => 'full', 'cart_button' => 'button', 'ajax_cart' => true, 'scroll_offset' => 15, 'description_length' => 15, 'links' => 'all', 'lazy_load' => false, 'cache' => false, 'image_size' => '70x70', 'lightbox' => true, 'shortcodes' => false, 'button_text' => '', 'date_format' => '', 'date_columns' => '', 'no_products_message' => '', 'no_products_filtered_message' => '', 'paging_type' => 'numbers', 'page_length' => 'bottom', 'search_box' => true, 'totals' => 'bottom', 'pagination' => 'bottom', 'reset_button' => true, 'add_selected_button' => 'top', 'user_products' => false, 'rows_per_page' => 25, 'product_limit' => 500, 'sort_by' => 'menu_order', 'sort_order' => '', 'status' => 'publish', 'category' => '', 'exclude_category' => '', 'tag' => '', 'term' => '', 'numeric_terms' => false, 'cf' => '', 'year' => '', 'month' => '', 'day' => '', 'exclude' => '', 'include' => '', 'search_term' => '', 'stock' => '', 'show_hidden_columns' => false]

The default args.

Tags
depreated

3.0.2 Replaced by Use Defaults::get_table_defaults(). This will be removed in a future update.

$description_length

public mixed $description_length

$exclude_category

public mixed $exclude_category

$no_products_filtered_message

public mixed $no_products_filtered_message

$no_products_message

public mixed $no_products_message

$responsive_control

public mixed $responsive_control

$responsive_display

public mixed $responsive_display

$search_filters

public mixed $search_filters = []

$show_hidden_columns

public mixed $show_hidden_columns

$user_search_term

public mixed $user_search_term

$variation_name_format

public mixed $variation_name_format

$args

The args array.

private array<string|int, mixed> $args = []

$site_defaults

The site-wide table options after merging with the plugin settings.

private static array<string|int, mixed> $site_defaults = null

Methods

__construct()

Constructs a new table args object based on the supplied args. Args are validated and any missing args are merged in, and stored in the $args property.

public __construct(array<string|int, mixed> $args) : mixed

For any args that can accept a list of items (e.g. $columns, $category, etc) the list should be comma-separated.

Parameters
$args : array<string|int, mixed>

{

Tags
type

string|string[] $columns The columns for the table. Any combination of: id, sku, name, description, summary, date, date_modified, categories, tags, image, reviews, stock, weight, dimensions, price, buy, button, as well as attributes (att:pa_size), taxonomies (tax:product_vendor) or custom fields (cf:my_field).

type

string $widths The column widths. A comma-separate list (one for each column) with an integer, pixels, percentage or the word 'auto' supplied for each. E.g. 20px,30,auto,20. An integer is treated as a percentage, so 30 is 30%.

type

string $responsive_control The responsive control type for child rows: inline or column.

type

string $responsive_display The responsive display type: child_row, child_row_visible, or modal.

type

string $cart_button The cart button type: button, button_checkbox, or checkbox.

type

int $description_length The description length (the number of words).

type

string $Links The table links: all, none, or any combination of id, sku, name, image, tags, categories, terms, attributes.

type

string $category The category or categories to display products from. Accepts a list of slugs or IDs.

type

string $exclude_category Exclude categories from the table. Accepts a list of slugs or IDs.

type

string $tag The tag(s) to display products from. Accepts a list of slugs or IDs.

type

string $term The term(s) to display products from. Accepts a list of terms in the form :.

type

bool $numeric_terms Set to true if using categories, tags or terms with numeric slugs.

type

string $cf The custom field(s) to display products from. Accepts a list of fields in the form <field_key>:<field_value>.

type

int $year The year to select products from. Use a 4-digit year, e.g. 2011.

type

int $month The month to select products from. Use a 2-digit month, e.g. 12.

type

int $day The day to select products from. Use a 2-digit day, e.g. 03.

type

string $exclude The list of products to exclude, as a list of product IDs.

type

string $include The list of products to include, as a list of product IDs. If specified, other selection parameters are ignored. }

Return values
mixed

__get()

Magic __get method.

public __get(string $name) : mixed
Parameters
$name : string

The property to get.

Return values
mixed

back_compat_args()

Maintain support for old arg names.

public static back_compat_args(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

The product table args to check.

Return values
array<string|int, mixed>

The updated attributes with old ones replaced with their new equivalent.

get_args()

Get the table args.

public get_args() : array<string|int, mixed>
Return values
array<string|int, mixed>

The table args.

get_defaults()

Get the default table args based on the the options set in the plugin settings.

public static get_defaults() : array<string|int, mixed>
Return values
array<string|int, mixed>

The site defaults.

get_site_defaults()

To work with the table builder.

public static get_site_defaults() : mixed
Return values
mixed

get_table_defaults()

Deprecated.

public static get_table_defaults() : mixed
Tags
deprecated
3.0.2

Replaced by Defaults::get_table_defaults.

Return values
mixed

get_user_defaults()

Deprecated.

public static get_user_defaults() : mixed
Tags
deprecated
3.0.2

Renamed get_defaults().

Return values
mixed

is_multi_add_to_cart()

Is this table using the multi add to cart feature?

public is_multi_add_to_cart() : bool
Return values
bool

true if multi-cart is enabled.

parse_columns_arg()

Deprecated.

public static parse_columns_arg(mixed $columns) : mixed
Parameters
$columns : mixed
Tags
deprecated
3.0.2

Replaced by Columns::parse_columns().

Return values
mixed

parse_filters_arg()

Deprecated.

public static parse_filters_arg(mixed $filters[, array<string|int, mixed> $columns = [] ][, mixed $variations = false ]) : mixed
Parameters
$filters : mixed
$columns : array<string|int, mixed> = []
$variations : mixed = false
Tags
deprecated
3.0.2

Replaced by Columns::parse_filters().

Return values
mixed

set_args()

Set the table args. Not all args need to be supplied - new args will be merged in to the existing, and only those specified in the new args will be overwritten.

public set_args(array<string|int, mixed> $args) : void
Parameters
$args : array<string|int, mixed>

The new table args.

Return values
void

array_filter_custom_field_or_taxonomy()

private array_filter_custom_field_or_taxonomy(mixed $column) : mixed
Parameters
$column : mixed
Return values
mixed

array_filter_taxonomy_or_attribute()

private array_filter_taxonomy_or_attribute(mixed $column) : mixed
Parameters
$column : mixed
Return values
mixed

array_filter_validate_boolean()

private array_filter_validate_boolean(mixed $var) : mixed
Parameters
$var : mixed
Return values
mixed

parse_args()

private parse_args(array<string|int, mixed> $args) : mixed
Parameters
$args : array<string|int, mixed>
Return values
mixed

set_columns()

private set_columns() : mixed
Return values
mixed

set_filters()

private set_filters() : mixed
Return values
mixed

set_image_column_width()

private set_image_column_width() : mixed
Return values
mixed

set_image_size()

private set_image_size() : mixed
Return values
mixed

Search results