Admin_Ajax implements Registerable
Handles all ajax requests from the admin panel for the plugin.
Tags
Interfaces, Classes and Traits
- Registerable
Table of Contents
- create_group() : void
- Create a group in the database.
- delete_group() : void
- Delete a group from the database.
- duplicate_group() : void
- Duplicate a filter group.
- get_group() : void
- Get details about a given group.
- get_groups() : void
- Get filter group from the database.
- get_terms_taxonomies() : void
- Get the list of taxonomies and attributes available for products.
- register() : void
- Hook into WP
- save_group() : void
- Save or create a group in the database.
- save_priority() : void
- Save the priority of groups.
- send_error() : void
- Send a json error back to the react app.
- validate_custom_fields_settings() : array<string|int, mixed>
- Validate settings of custom fields.
- fix_filter_ids() : void
- Navigate through the filters and fix the "filter_id" property inside the options array but only if "filter_id" exists.
- fix_parent_filter_ids() : void
- Navigate through the filters and fix the "parent_filter" column but only if the "parent_filter" is different than 0.
- has_unique_sources() : bool|WP_Error
- Determine if the collection of filters has filters that are sharing the same data source or in the case of attributes, determine if there's any conflict.
- validate_filter_settings() : void
- Validate various settings about a given filter.
Methods
create_group()
Create a group in the database.
public
create_group() : void
Used by the modal form on the add/Edit filter page.
Return values
void —delete_group()
Delete a group from the database.
public
delete_group() : void
Return values
void —duplicate_group()
Duplicate a filter group.
public
duplicate_group() : void
Return values
void —get_group()
Get details about a given group.
public
get_group() : void
Return values
void —get_groups()
Get filter group from the database.
public
get_groups() : void
Return values
void —get_terms_taxonomies()
Get the list of taxonomies and attributes available for products.
public
get_terms_taxonomies() : void
Return values
void —register()
Hook into WP
public
register() : void
Return values
void —save_group()
Save or create a group in the database.
public
save_group() : void
Return values
void —save_priority()
Save the priority of groups.
public
save_priority() : void
Return values
void —send_error()
Send a json error back to the react app.
public
send_error(string $message) : void
Parameters
- $message : string
Return values
void —validate_custom_fields_settings()
Validate settings of custom fields.
public
validate_custom_fields_settings(array<string|int, mixed> $filters) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed>
Return values
array<string|int, mixed> —fix_filter_ids()
Navigate through the filters and fix the "filter_id" property inside the options array but only if "filter_id" exists.
private
fix_filter_ids(Group $group) : void
The new filter_id is the one of the newly created filter.
This is needed because when duplicating a group, the filters are duplicated too but the filter_id is not updated.
Parameters
- $group : Group
Return values
void —fix_parent_filter_ids()
Navigate through the filters and fix the "parent_filter" column but only if the "parent_filter" is different than 0.
private
fix_parent_filter_ids(Group $group) : void
To retrieve the new parent_filter we need to query the database and get the new filter_id of the filter in the group that has the option "attributes_mode" set to "all".
Parameters
- $group : Group
Return values
void —has_unique_sources()
Determine if the collection of filters has filters that are sharing the same data source or in the case of attributes, determine if there's any conflict.
private
has_unique_sources(Collection $filters) : bool|WP_Error
Parameters
- $filters : Collection
Return values
bool|WP_Error —validate_filter_settings()
Validate various settings about a given filter.
private
validate_filter_settings(array<string|int, mixed> &$filter) : void
Parameters
- $filter : array<string|int, mixed>