Sale extends Type implements Indexable_Filter, Filterable_Filter, Queriable_Filter, Formattable_Filter

Represents a filter type.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Indexable_Filter
Indexable_Filter provides a single method "generate_index_data".
Filterable_Filter
Filterable_Filter provides a single method "get_indexed_values".
Queriable_Filter
Queriable_Filter provides a single method "attach_statement".
Formattable_Filter
Formattable_Filter interface provides a single method "get_active_formatted_values".

Table of Contents

$filter  : Filter
The filter object.
__construct()  : mixed
Initialize the type.
attach_statement()  : void
Attach a statement to the filtering query.
generate_index_data()  : array<string|int, mixed>
Generate data for the indexer.
get_active_formatted_values()  : string
Get the formatted values of the filter that are currently active.
get_filter()  : Filter
Get the filter object.
get_ids_from_results()  : array<string|int, mixed>
Get the post IDs from the results.
get_indexed_values()  : array<string|int, mixed>
Get indexed values for this filter type.
get_matching_posts()  : array<string|int, mixed>
Get the posts that match the selected sale filter.

Properties

Methods

__construct()

Initialize the type.

public __construct(Filter $filter) : mixed
Parameters
$filter : Filter

The filter object.

Return values
mixed

attach_statement()

Attach a statement to the filtering query.

public attach_statement(Query &$statement[, bool $is_first = false ]) : void

This method is responsible for attaching a statement to the filtering query, making it possible to query the database for the filtered products.

Parameters
$statement : Query

The query object to modify.

$is_first : bool = false

Whether this is the first filter in the query.

Return values
void

generate_index_data()

Generate data for the indexer.

public generate_index_data(array<string|int, mixed> $defaults, string $post_id) : array<string|int, mixed>
Parameters
$defaults : array<string|int, mixed>

default index values

$post_id : string

the ID of the post to index

Tags
inheritdoc
Return values
array<string|int, mixed>

get_active_formatted_values()

Get the formatted values of the filter that are currently active.

public get_active_formatted_values() : string
Return values
string

get_filter()

Get the filter object.

public get_filter() : Filter
Return values
Filter

get_ids_from_results()

Get the post IDs from the results.

public get_ids_from_results(array<string|int, mixed> $results) : array<string|int, mixed>
Parameters
$results : array<string|int, mixed>

The results from the database.

Return values
array<string|int, mixed>

get_indexed_values()

Get indexed values for this filter type.

public get_indexed_values([array<string|int, mixed> $posts = [] ]) : array<string|int, mixed>
Parameters
$posts : array<string|int, mixed> = []

The posts to look up. When empty, all values will be returned.

Return values
array<string|int, mixed>

get_matching_posts()

Get the posts that match the selected sale filter.

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

Search results