Columns_Util
Column utility functions.
Tags
Table of Contents
- $column_defaults : array<string|int, mixed>
- Column default headings and priorities.
- check_blank_heading() : mixed
- column_defaults() : mixed
- columns_array_to_string() : mixed
- get_column_class() : mixed
- get_column_data_source() : mixed
- get_column_name() : mixed
- get_column_taxonomy() : string|false
- Get the taxonomy slug for a column name.
- get_column_type() : string|void
- Get column type for a specific provided column
- get_combined_column() : string|false
- Retrieves the combined column name if it is a combined column.
- get_custom_field() : mixed
- get_custom_taxonomy() : mixed
- get_filter_column() : mixed
- get_hidden_filter() : mixed
- is_combined_column() : bool
- Checks if the given column name is a combined column.
- is_custom_field() : mixed
- is_custom_taxonomy() : mixed
- is_filter_column() : mixed
- is_hidden_filter() : mixed
- is_retreiving_specific_cf_field_posts() : bool
- Checks if a specific custom field is being used to retrieve specific posts for custom fields.
- parse_columns() : array<string|int, mixed>
- Parse the supplied columns into an array, whose keys are the column names, and values are the column headings (if specified).
- parse_filters() : array<string|int, mixed>
- Parse the supplied filters into an array, whose keys are the filter names, and values are the filter headings (if specified).
- remove_non_applicable_columns() : mixed
- sanitize_heading() : mixed
- unprefix_column() : mixed
Properties
$column_defaults
Column default headings and priorities.
private
static array<string|int, mixed>
$column_defaults
= null
Tags
Methods
check_blank_heading()
public
static check_blank_heading(mixed $heading) : mixed
Parameters
- $heading : mixed
Tags
Return values
mixed —column_defaults()
public
static column_defaults() : mixed
Return values
mixed —columns_array_to_string()
public
static columns_array_to_string(array<string|int, mixed> $columns) : mixed
Parameters
- $columns : array<string|int, mixed>
Tags
Return values
mixed —get_column_class()
public
static get_column_class(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_column_data_source()
public
static get_column_data_source(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_column_name()
public
static get_column_name(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_column_taxonomy()
Get the taxonomy slug for a column name.
public
static get_column_taxonomy(string $column) : string|false
Parameters
- $column : string
-
The name of the column.
Tags
Return values
string|false —The taxonomy slug, or false if the column is not a taxonomy column.
get_column_type()
Get column type for a specific provided column
public
static get_column_type(array<string|int, mixed> $columnns, string $type) : string|void
Parameters
- $columnns : array<string|int, mixed>
- $type : string
Tags
Return values
string|void —get_combined_column()
Retrieves the combined column name if it is a combined column.
public
static get_combined_column(string $column) : string|false
A combined column is identified by the presence of either a comma (',') or a semicolon (';') in the column name.
Parameters
- $column : string
-
The column name to check.
Tags
Return values
string|false —The combined column name if it is a combined column, false otherwise.
get_custom_field()
public
static get_custom_field(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_custom_taxonomy()
public
static get_custom_taxonomy(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_filter_column()
public
static get_filter_column(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —get_hidden_filter()
public
static get_hidden_filter(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —is_combined_column()
Checks if the given column name is a combined column.
public
static is_combined_column(string $column) : bool
A combined column is identified by the presence of either a comma (',') or a semicolon (';') in the column name.
Parameters
- $column : string
-
The column name to check.
Tags
Return values
bool —True if the column is a combined column, false otherwise.
is_custom_field()
public
static is_custom_field(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —is_custom_taxonomy()
public
static is_custom_taxonomy(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —is_filter_column()
public
static is_filter_column(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —is_hidden_filter()
public
static is_hidden_filter(mixed $column) : mixed
Parameters
- $column : mixed
Tags
Return values
mixed —is_retreiving_specific_cf_field_posts()
Checks if a specific custom field is being used to retrieve specific posts for custom fields.
public
static is_retreiving_specific_cf_field_posts(string $cf_field, string $cf_filter_data) : bool
Determines whether the current custom field matches the field name in the filter data. This is used to verify if posts are being filtered by a specific custom field.
Parameters
- $cf_field : string
-
The custom field name to check.
- $cf_filter_data : string
-
The filter data string to compare against.
Tags
Return values
bool —Returns true if the custom field matches the filter, false if no filter data.
parse_columns()
Parse the supplied columns into an array, whose keys are the column names, and values are the column headings (if specified).
public
static parse_columns(string|array<string|int, string> $columns) : array<string|int, mixed>
Invalid taxonomies are removed, but non-standard columns are kept as they could be custom columns. Custom field keys are not validated.
E.g. parse_columns( 'title,author:User,content,tax:region:Area,cf:my_field' );
Returns:
[ 'title' => '', 'author' => 'User', 'content' => '', 'tax:region' => 'Area', 'cf:my_field' => '' ];
Parameters
- $columns : string|array<string|int, string>
-
The columns to parse as a string or array of strings.
Tags
Return values
array<string|int, mixed> —The parsed columns.
parse_filters()
Parse the supplied filters into an array, whose keys are the filter names, and values are the filter headings (if specified).
public
static parse_filters(bool|string|array<string|int, string> $filters[, array<string|int, string> $table_columns = [] ]) : array<string|int, mixed>
Invalid filter columns and taxonomies are removed. When $filters = true, the filters are based on the table contents and this is specified by passing the columns in the $table_columns arg.
E.g. parse_filters( 'categories:Category,invalid,tags,tax:region:Area' );
Returns:
[ 'categories' => 'Category', 'tags' => '', 'tax:region' => 'Area' ];
Parameters
- $filters : bool|string|array<string|int, string>
-
The filters to parse as a string or array of strings.
- $table_columns : array<string|int, string> = []
-
The columns to base the filters on when $filters = true.
Tags
Return values
array<string|int, mixed> —The parsed filters, or an empty array if the filters are invalid.
remove_non_applicable_columns()
public
static remove_non_applicable_columns(mixed $columns, mixed $post_type) : mixed
Parameters
- $columns : mixed
- $post_type : mixed
Tags
Return values
mixed —sanitize_heading()
public
static sanitize_heading(mixed $heading) : mixed
Parameters
- $heading : mixed
Tags
Return values
mixed —unprefix_column()
public
static unprefix_column(mixed $column) : mixed
Parameters
- $column : mixed