Price extends Type implements Indexable_Filter, Filterable_Filter, Queriable_Filter, Formattable_Filter, Injectable_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".
Injectable_Filter
Injectable_Filter interface

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_formatted_search_query()  : array<string|int, mixed>
Format the search query to ensure it's an array of integers.
get_ids_from_results()  : array<string|int, mixed>
Get the post IDs from the results.
get_indexed_values()  : array<string|int, mixed>
Get the indexed values for the filter.
get_matching_posts()  : array<string|int, mixed>
Get the posts that match the selected price range.
inject_properties()  : array<string|int, mixed>
Inject properties into the possible choices.

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
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_formatted_search_query()

Format the search query to ensure it's an array of integers.

public get_formatted_search_query(string|array<string|int, mixed> $search_query) : array<string|int, mixed>
Parameters
$search_query : string|array<string|int, mixed>

The input search query.

Return values
array<string|int, mixed>

An array of integers.

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 the indexed values for the filter.

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

The posts to get the indexed values for.

Return values
array<string|int, mixed>

get_matching_posts()

Get the posts that match the selected price range.

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

inject_properties()

Inject properties into the possible choices.

public inject_properties(array<string|int, mixed> $possible_choices) : array<string|int, mixed>
Parameters
$possible_choices : array<string|int, mixed>

The possible choices.

Return values
array<string|int, mixed>

The possible choices with injected properties.

Search results