WooCommerce Code Reference

WC_Admin_Log_Table_List extends WP_List_Table
in package

Table of Contents

PER_PAGE_USER_OPTION_KEY  = 'woocommerce_status_log_items_per_page'
The key for the user option of how many list table items to display per page.
SOURCE_CACHE_OPTION_KEY  = 'woocommerce_status_log_db_sources'
The key for the option that stores the list of unique sources that exist in the log table.
ITEM_COUNT_CACHE_THRESHOLD  = 100000
If the number of log entries is over this number, cache the query that gets the total count.
__construct()  : mixed
Initialize the log table list.
column_cb()  : string
Column cb.
column_context()  : string
Context column.
column_level()  : string
Level column.
column_message()  : string
Message column.
column_source()  : string
Source column.
column_timestamp()  : string
Timestamp column.
display_rows()  : void
Generates the table rows.
get_columns()  : array<string|int, mixed>
Get list columns.
get_per_page_default()  : int
Helper to get the default value for the per_page arg.
level_dropdown()  : mixed
Display level dropdown
prepare_items()  : mixed
Prepare table list items.
context_row()  : void
Render the additional table row that contains extra log context data.
extra_tablenav()  : mixed
Extra controls to be displayed between bulk actions and pagination.
get_bulk_actions()  : array<string|int, mixed>
Get bulk actions.
get_items_query_limit()  : string
Get prepared LIMIT clause for items query
get_items_query_offset()  : string
Get prepared OFFSET clause for items query
get_items_query_order()  : string
Get prepared ORDER BY clause for items query
get_items_query_where()  : string
Get prepared WHERE clause for items query
get_sortable_columns()  : array<string|int, mixed>
Get a list of sortable columns.
get_sources()  : array<string|int, mixed>
Get the list of unique sources in the log table.
get_total_items_count()  : int
Get the total count of log entries in the database.
prepare_column_headers()  : mixed
Set _column_headers property for table list
source_dropdown()  : mixed
Display source dropdown

Constants

PER_PAGE_USER_OPTION_KEY

The key for the user option of how many list table items to display per page.

public mixed PER_PAGE_USER_OPTION_KEY = 'woocommerce_status_log_items_per_page'
Tags
const

string

SOURCE_CACHE_OPTION_KEY

The key for the option that stores the list of unique sources that exist in the log table.

public mixed SOURCE_CACHE_OPTION_KEY = 'woocommerce_status_log_db_sources'
Tags
const

string

Methods

context_row()

Render the additional table row that contains extra log context data.

protected context_row(array<string|int, mixed> $log) : void
Parameters
$log : array<string|int, mixed>

Log entry data.

Return values
void

extra_tablenav()

Extra controls to be displayed between bulk actions and pagination.

protected extra_tablenav(string $which) : mixed
Parameters
$which : string
Return values
mixed

get_items_query_limit()

Get prepared LIMIT clause for items query

protected get_items_query_limit() : string
Tags
global

wpdb $wpdb

Return values
stringPrepared LIMIT clause for items query.

get_items_query_offset()

Get prepared OFFSET clause for items query

protected get_items_query_offset() : string
Tags
global

wpdb $wpdb

Return values
stringPrepared OFFSET clause for items query.

get_items_query_where()

Get prepared WHERE clause for items query

protected get_items_query_where() : string
Tags
global

wpdb $wpdb

Return values
stringPrepared WHERE clause for items query.

get_sources()

Get the list of unique sources in the log table.

protected get_sources() : array<string|int, mixed>

The query in this method can be slow when there are a high number of log entries. The list of sources also most likely doesn't change that often. So this indefinitely caches the list into the WP options table. The cache will get cleared by the log handler if a new source is being added. See WC_Log_Handler_DB::handle().

Return values
array<string|int, mixed>

get_total_items_count()

Get the total count of log entries in the database.

protected get_total_items_count() : int

The query in this method can be slow if there are a large (100k+) rows in the database table, so this uses a transient to cache the count for 10 minutes if the count is over that threshold.

Return values
int