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
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
ITEM_COUNT_CACHE_THRESHOLD
If the number of log entries is over this number, cache the query that gets the total count.
private
mixed
ITEM_COUNT_CACHE_THRESHOLD
= 100000
Methods
__construct()
Initialize the log table list.
public
__construct() : mixed
Return values
mixed —column_cb()
Column cb.
public
column_cb(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
Return values
string —column_context()
Context column.
public
column_context(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
-
Log entry data.
Return values
string —column_level()
Level column.
public
column_level(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
Return values
string —column_message()
Message column.
public
column_message(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
Return values
string —column_source()
Source column.
public
column_source(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
Return values
string —column_timestamp()
Timestamp column.
public
column_timestamp(array<string|int, mixed> $log) : string
Parameters
- $log : array<string|int, mixed>
Return values
string —display_rows()
Generates the table rows.
public
display_rows() : void
Return values
void —get_columns()
Get list columns.
public
get_columns() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_per_page_default()
Helper to get the default value for the per_page arg.
public
get_per_page_default() : int
Return values
int —level_dropdown()
Display level dropdown
public
level_dropdown() : mixed
Tags
Return values
mixed —prepare_items()
Prepare table list items.
public
prepare_items() : mixed
Tags
Return values
mixed —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_bulk_actions()
Get bulk actions.
protected
get_bulk_actions() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_items_query_limit()
Get prepared LIMIT clause for items query
protected
get_items_query_limit() : string
Tags
Return values
string — Prepared LIMIT clause for items query.get_items_query_offset()
Get prepared OFFSET clause for items query
protected
get_items_query_offset() : string
Tags
Return values
string — Prepared OFFSET clause for items query.get_items_query_order()
Get prepared ORDER BY clause for items query
protected
get_items_query_order() : string
Return values
string — Prepared ORDER BY clause for items query.get_items_query_where()
Get prepared WHERE clause for items query
protected
get_items_query_where() : string
Tags
Return values
string — Prepared WHERE clause for items query.get_sortable_columns()
Get a list of sortable columns.
protected
get_sortable_columns() : array<string|int, mixed>
Return values
array<string|int, mixed> —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 —prepare_column_headers()
Set _column_headers property for table list
protected
prepare_column_headers() : mixed
Return values
mixed —source_dropdown()
Display source dropdown
protected
source_dropdown() : mixed