Plugin_Restaurant_Ordering implements Registerable, JsonSerializable
Adds filtering support for the restaurant ordering plugin.
Interfaces, Classes and Traits
- Registerable
- JsonSerializable
Table of Contents
- INTEGRATION_PREFIX = '_wro'
- Holds the prefix used for identifying the query.
- $cache : Query_Cache
- Holds the query and filters cache handler.
- $restaurant_page_id : string|bool
- Holds the ID number of the restaurant order page selected through the plugin's settings.
- add_argument_to_query() : array<string|int, mixed>
- Add the filtering flag to the queries.
- add_closing_tag() : mixed
- add_fallback_elements() : string
- Add an hidden div that contains the total number of products that the table's query has produced.
- add_opening_tag() : mixed
- assets() : void
- Load the integration js files.
- cache_query() : void
- Cache the prefilled query so that it can then be used at a later point when sending back an ajax response.
- disable_wp_query_wrapper() : void
- Disable the original query wrapper because elementor runs queries twice so the wrapper goes to the wrong place.
- get_query_argument_id() : string
- Get the string that is then attached as an argument to the WP_Query $args array as a flag.
- init() : void
- Hook into WP.
- inject_template() : void
- Print the expected json response before headers are sent.
- intercept() : void
- Intercept the search request, load the hooks and buffer the output.
- jsonSerialize() : array<string|int, mixed>
- Prepare fallback json array.
- register() : void
- Register the integration.
Constants
INTEGRATION_PREFIX
Holds the prefix used for identifying the query.
public
mixed
INTEGRATION_PREFIX
= '_wro'
Properties
$cache
Holds the query and filters cache handler.
protected
Query_Cache
$cache
$restaurant_page_id
Holds the ID number of the restaurant order page selected through the plugin's settings.
protected
string|bool
$restaurant_page_id
Methods
add_argument_to_query()
Add the filtering flag to the queries.
public
add_argument_to_query(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
Return values
array<string|int, mixed> —add_closing_tag()
public
add_closing_tag() : mixed
Return values
mixed —add_fallback_elements()
Add an hidden div that contains the total number of products that the table's query has produced.
public
add_fallback_elements(string $output, array<string|int, mixed> $options, array<string|int, mixed> $products) : string
We need this because there's no other way to retrieve the number that we need to show inside our sidebar filters.
Parameters
- $output : string
-
original output
- $options : array<string|int, mixed>
-
menu options
- $products : array<string|int, mixed>
-
list of products inside the query.
Return values
string —add_opening_tag()
public
add_opening_tag() : mixed
Return values
mixed —assets()
Load the integration js files.
public
assets() : void
Return values
void —cache_query()
Cache the prefilled query so that it can then be used at a later point when sending back an ajax response.
public
cache_query(WP_Query $query, Collection $filters, string $orderby, array<string|int, mixed> $post_ids) : void
Parameters
- $query : WP_Query
- $filters : Collection
- $orderby : string
- $post_ids : array<string|int, mixed>
Return values
void —disable_wp_query_wrapper()
Disable the original query wrapper because elementor runs queries twice so the wrapper goes to the wrong place.
public
disable_wp_query_wrapper() : void
Return values
void —get_query_argument_id()
Get the string that is then attached as an argument to the WP_Query $args array as a flag.
public
get_query_argument_id() : string
The flag is used to shortcircuit our filtered results injection.
Without the flag we'd end up causing an infinite loop.
Return values
string —init()
Hook into WP.
public
init() : void
Return values
void —inject_template()
Print the expected json response before headers are sent.
public
inject_template() : void
Return values
void —intercept()
Intercept the search request, load the hooks and buffer the output.
public
intercept() : void
Return values
void —jsonSerialize()
Prepare fallback json array.
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —register()
Register the integration.
public
register() : void