Filter extends Entity implements IMappableEntity, JsonSerializable Uses Entity_ID, Entity_Assignable, Entity_Database_Prefix
Represents a filter from the database.
Tags
Interfaces, Classes and Traits
- IMappableEntity
- JsonSerializable
Table of Contents
- $search_query : string
- The search query for the filter.
- all() : array<string|int, mixed>
- Get all filters.
- assign() : self
- Assign mass data to entity.
- clear_all_options_cache() : void
- Clear all filter options cache.
- create() : Filter
- Create a new filter.
- delete() : bool
- Delete the filter.
- get_attribute_orderby_args() : array<string|int, mixed>
- Get the attribute orderby arguments for the filter based on the taxonomy.
- get_data_source() : string
- Get the data source for the filter.
- get_database_prefix() : string
- Retrieve database prefix.
- get_filter_by() : string
- Get the filter type.
- get_groups() : array<string|int, mixed>
- Get a list of the groups ids to which the filter belongs to.
- get_groups_names() : array<string|int, string>
- Get a list of the names of the groups to which the filter belongs to.
- get_id() : int
- Retrieve ID of the Entity Alias of id()
- get_input_type() : string
- Get the input type for the filter.
- get_name() : string
- Get name of the filter.
- get_option() : mixed
- Get a specific option from the filter options.
- get_options() : array<string|int, mixed>
- Get the filter options.
- get_parent_filter_id() : string|null
- Get the parent filter id number.
- get_search_query() : mixed
- Get the search query for the filter.
- get_slug() : string
- Get the slug of the filter.
- get_type() : Type|null
- Get the filter type instance.
- has_parent() : bool
- Determine if the filter has a parent filter.
- id() : int
- Retrieve ID of the Entity
- is_hidden() : bool
- Determine if this filter is hidden in the admin panel.
- is_range_filter() : bool
- Determine if the filter is a range filter.
- jsonSerialize() : mixed
- List of properties usually used via the rest api.
- mapEntity() : mixed
- {@inheritdoc}
- priority() : int
- Get the priority order number of the filter.
- replicate() : Filter
- Replicate the filter.
- set_filter_by() : self
- Set the filter type.
- set_id() : void
- Set ID of the Entity
- set_name() : self
- Set name of the filter.
- set_options() : self
- Set the filter options.
- set_parent_filter_id() : self
- Set the parent filter id number.
- set_priority() : self
- Set the filter priority order number.
- set_search_query() : mixed
- Set the search query for the filter.
- set_slug() : self
- Set the slug of the filter.
- update() : Filter
- Update the filter.
- update_groups() : Filter
- Add the filter to the new groups and remove the filter from all other groups.
- clear_options_cache() : void
- Clear the options cache for this filter.
- get_input_name() : string
- Retrieve the human readable name of the selected input type for the filter.
- get_source_name() : string
- Retrieve the human readable name of the selected source for the filter.
Properties
$search_query
The search query for the filter.
protected
string
$search_query
Methods
all()
Get all filters.
public
static all() : array<string|int, mixed>
Return values
array<string|int, mixed> —assign()
Assign mass data to entity.
public
assign(array<string|int, mixed> $data) : self
Parameters
- $data : array<string|int, mixed>
Return values
self —clear_all_options_cache()
Clear all filter options cache.
public
static clear_all_options_cache() : void
Return values
void —create()
Create a new filter.
public
static create(array<string|int, mixed> $attributes, array<string|int, mixed> $groups) : Filter
Parameters
- $attributes : array<string|int, mixed>
-
The filter attributes.
- $groups : array<string|int, mixed>
-
The groups to which the filter belongs to.
Return values
Filter —delete()
Delete the filter.
public
delete() : bool
Tags
Return values
bool —get_attribute_orderby_args()
Get the attribute orderby arguments for the filter based on the taxonomy.
public
get_attribute_orderby_args(string $taxonomy) : array<string|int, mixed>
Parameters
- $taxonomy : string
-
The taxonomy name.
Return values
array<string|int, mixed> —get_data_source()
Get the data source for the filter.
public
get_data_source() : string
Return values
string —get_database_prefix()
Retrieve database prefix.
public
get_database_prefix() : string
Return values
string —get_filter_by()
Get the filter type.
public
get_filter_by() : string
Return values
string —get_groups()
Get a list of the groups ids to which the filter belongs to.
public
get_groups() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_groups_names()
Get a list of the names of the groups to which the filter belongs to.
public
get_groups_names() : array<string|int, string>
Return values
array<string|int, string> —get_id()
Retrieve ID of the Entity Alias of id()
public
get_id() : int
Return values
int —get_input_type()
Get the input type for the filter.
public
get_input_type() : string
Return values
string —get_name()
Get name of the filter.
public
get_name() : string
Return values
string —get_option()
Get a specific option from the filter options.
public
get_option(string $key[, mixed $default_value = null ]) : mixed
Parameters
- $key : string
-
The option key.
- $default_value : mixed = null
-
The default value to return if the option does not exist.
Return values
mixed —get_options()
Get the filter options.
public
get_options() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_parent_filter_id()
Get the parent filter id number.
public
get_parent_filter_id() : string|null
Return values
string|null —get_search_query()
Get the search query for the filter.
public
get_search_query() : mixed
Return values
mixed —get_slug()
Get the slug of the filter.
public
get_slug() : string
Return values
string —get_type()
Get the filter type instance.
public
get_type() : Type|null
Return values
Type|null —has_parent()
Determine if the filter has a parent filter.
public
has_parent() : bool
Return values
bool —id()
Retrieve ID of the Entity
public
id() : int
Return values
int —is_hidden()
Determine if this filter is hidden in the admin panel.
public
is_hidden() : bool
Hidden filters are generated when an "all attributes" type of filter is created.
Return values
bool —is_range_filter()
Determine if the filter is a range filter.
public
is_range_filter() : bool
Return values
bool —jsonSerialize()
List of properties usually used via the rest api.
public
jsonSerialize() : mixed
Return values
mixed —mapEntity()
{@inheritdoc}
public
static mapEntity(IEntityMapper $mapper) : mixed
Parameters
- $mapper : IEntityMapper
Return values
mixed —priority()
Get the priority order number of the filter.
public
priority() : int
Return values
int —replicate()
Replicate the filter.
public
replicate() : Filter
Return values
Filter —set_filter_by()
Set the filter type.
public
set_filter_by(string $filter_by) : self
Parameters
- $filter_by : string
Return values
self —set_id()
Set ID of the Entity
public
set_id(int|string|null $id) : void
Parameters
- $id : int|string|null
-
ID of the Entity
Return values
void —set_name()
Set name of the filter.
public
set_name(string $name) : self
Parameters
- $name : string
Return values
self —set_options()
Set the filter options.
public
set_options(array<string|int, mixed> $options) : self
Parameters
- $options : array<string|int, mixed>
Return values
self —set_parent_filter_id()
Set the parent filter id number.
public
set_parent_filter_id(string $parent_filter_id) : self
Parameters
- $parent_filter_id : string
Return values
self —set_priority()
Set the filter priority order number.
public
set_priority(int $priority) : self
Parameters
- $priority : int
Return values
self —set_search_query()
Set the search query for the filter.
public
set_search_query(mixed $search_query) : mixed
Parameters
- $search_query : mixed
-
The search query.
Return values
mixed —set_slug()
Set the slug of the filter.
public
set_slug(string $slug) : self
Parameters
- $slug : string
Return values
self —update()
Update the filter.
public
update(array<string|int, mixed> $attributes) : Filter
Parameters
- $attributes : array<string|int, mixed>
-
The filter attributes.
Return values
Filter —update_groups()
Add the filter to the new groups and remove the filter from all other groups.
public
update_groups(array<string|int, mixed> $groups) : Filter
This method is best used when pre-serving the position of the filter into a group is needed.
Parameters
- $groups : array<string|int, mixed>
-
list of IDs of groups to which the filter should be added to.
Return values
Filter —clear_options_cache()
Clear the options cache for this filter.
protected
clear_options_cache() : void
Return values
void —get_input_name()
Retrieve the human readable name of the selected input type for the filter.
protected
get_input_name() : string
Return values
string —get_source_name()
Retrieve the human readable name of the selected source for the filter.
protected
get_source_name() : string