Config
extends WP_REST_Settings_Controller
in package
Uses
UtilsProvider
Create an config REST API, extending from the official `wp/v2/settings` route to also provide a route for all Real Cookie Banner specific settings.
Table of Contents
Methods
- filter_rest_post_collection_params() : array<string|int, mixed>
- Add custom 'status' parameter to post collection parameters.
- filter_rest_post_search_query() : array<string|int, mixed>
- Filter the search query to include custom post statuses when user has permission.
- filter_rest_post_type_item_schema() : array<string|int, mixed>
- Filter the post type item schema to add embed context to content properties.
- filter_rest_prepare_post() : WP_REST_Response
- Filter the post response to add typeSingular property.
- get_item_permissions_check() : mixed
- See `WP_REST_Settings_Controller`.
- get_registered_options() : array<string|int, mixed>
- Retrieves all of the registered options for the Settings API, specific to Real Cookie Banner.
- getPluginConstantPrefix() : string
- Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
- instance() : mixed
- New instance.
- modify_wp_post_types_temporarily() : mixed
- Make our registered post types public for the search endpoint so it works for the "Connected services" field. This is a hacky way as WordPress itself does not allow to include private post types to the `wp/v2/search` REST API endpoint.
- permission_callback() : mixed
- Check if user is allowed to call this service requests.
- rest_api_init() : mixed
- Register endpoints.
- rest_post_dispatch() : mixed
- Check if settings got updated and `do_action`.
- routeCookieGroupsOrder() : mixed
- See API docs.
- routeCookiesOrder() : mixed
- See API docs.
- routeCookiesUnassigned() : mixed
- See API docs.
- routeCountryBypassDownload() : mixed
- See API docs.
- routeCreateCookiePolicy() : mixed
- See API docs.
- routeGetChecklist() : mixed
- See API docs.
- routeGetRevisionByHash() : mixed
- See API docs.
- routeGetRevisionCurrent() : mixed
- See API docs.
- routeGetRevisionIndependentByHash() : mixed
- See API docs.
- routeGetRevisionSecondView() : mixed
- See API docs.
- routeMigrationDelete() : mixed
- See API docs.
- routeMigrationPost() : mixed
- See API docs.
- routeNavMenuAddLinksPost() : mixed
- See API docs.
- routePutChecklist() : mixed
- See API docs.
- routePutRevisionCurrent() : mixed
- See API docs.
Methods
filter_rest_post_collection_params()
Add custom 'status' parameter to post collection parameters.
public
filter_rest_post_collection_params(array<string|int, mixed> $query_params, WP_Post_Type $post_type) : array<string|int, mixed>
Parameters
- $query_params : array<string|int, mixed>
-
JSON Schema-formatted collection parameters.
- $post_type : WP_Post_Type
-
Post type object.
Return values
array<string|int, mixed> —Modified collection parameters.
filter_rest_post_search_query()
Filter the search query to include custom post statuses when user has permission.
public
filter_rest_post_search_query(array<string|int, mixed> $args, WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $args : array<string|int, mixed>
-
The search query arguments.
- $request : WP_REST_Request
-
The REST request object.
Return values
array<string|int, mixed> —Modified search query arguments.
filter_rest_post_type_item_schema()
Filter the post type item schema to add embed context to content properties.
public
filter_rest_post_type_item_schema(array<string|int, mixed> $schema) : array<string|int, mixed>
Additionally, add type_singular
property to the schema.
Parameters
- $schema : array<string|int, mixed>
Return values
array<string|int, mixed>filter_rest_prepare_post()
Filter the post response to add typeSingular property.
public
filter_rest_prepare_post(WP_REST_Response $response, WP_Post $post, WP_REST_Request $request) : WP_REST_Response
Parameters
- $response : WP_REST_Response
-
The response object.
- $post : WP_Post
-
The post object.
- $request : WP_REST_Request
-
The request object.
Return values
WP_REST_Response —Modified response object.
get_item_permissions_check()
See `WP_REST_Settings_Controller`.
public
get_item_permissions_check(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
-
Full details about the request.
get_registered_options()
Retrieves all of the registered options for the Settings API, specific to Real Cookie Banner.
public
get_registered_options() : array<string|int, mixed>
Return values
array<string|int, mixed> —Array of registered options.
getPluginConstantPrefix()
Get the prefix of this plugin so composer packages can dynamically build other constant values on it.
public
getPluginConstantPrefix() : string
Tags
Return values
stringinstance()
New instance.
public
static instance() : mixed
modify_wp_post_types_temporarily()
Make our registered post types public for the search endpoint so it works for the "Connected services" field. This is a hacky way as WordPress itself does not allow to include private post types to the `wp/v2/search` REST API endpoint.
public
modify_wp_post_types_temporarily(array<string|int, mixed> $queryVars) : mixed
Parameters
- $queryVars : array<string|int, mixed>
Tags
permission_callback()
Check if user is allowed to call this service requests.
public
permission_callback() : mixed
rest_api_init()
Register endpoints.
public
rest_api_init() : mixed
rest_post_dispatch()
Check if settings got updated and `do_action`.
public
rest_post_dispatch(WP_HTTP_Response $response, WP_REST_Server $server, WP_REST_Request $request) : mixed
Parameters
- $response : WP_HTTP_Response
- $server : WP_REST_Server
- $request : WP_REST_Request
routeCookieGroupsOrder()
See API docs.
public
routeCookieGroupsOrder(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeCookiesOrder()
See API docs.
public
routeCookiesOrder(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeCookiesUnassigned()
See API docs.
public
routeCookiesUnassigned() : mixed
Tags
routeCountryBypassDownload()
See API docs.
public
routeCountryBypassDownload() : mixed
Tags
routeCreateCookiePolicy()
See API docs.
public
routeCreateCookiePolicy(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeGetChecklist()
See API docs.
public
routeGetChecklist() : mixed
Tags
routeGetRevisionByHash()
See API docs.
public
routeGetRevisionByHash(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeGetRevisionCurrent()
See API docs.
public
routeGetRevisionCurrent() : mixed
Tags
routeGetRevisionIndependentByHash()
See API docs.
public
routeGetRevisionIndependentByHash(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeGetRevisionSecondView()
See API docs.
public
routeGetRevisionSecondView() : mixed
Tags
routeMigrationDelete()
See API docs.
public
routeMigrationDelete(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeMigrationPost()
See API docs.
public
routeMigrationPost(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routeNavMenuAddLinksPost()
See API docs.
public
routeNavMenuAddLinksPost(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routePutChecklist()
See API docs.
public
routePutChecklist(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request
Tags
routePutRevisionCurrent()
See API docs.
public
routePutRevisionCurrent(WP_REST_Request $request) : mixed
Parameters
- $request : WP_REST_Request