Documentation

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
codeCoverageIgnore

It only returns a string with the constant prefix

Return values
string

instance()

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
see
https://github.com/WordPress/WordPress/blob/4f8f6e9fa25f598fc06829d0ea72caac4d3d60e4/wp-includes/rest-api/search/class-wp-rest-post-search-handler.php#L28-L39

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
APIYes
Parameters
$request : WP_REST_Request
Tags
apiHeader

{string} X-WP-Nonce

apiParam

{number[]} ids

apiName

CookieGroupsOrder

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeCookiesOrder()

See API docs.

public routeCookiesOrder(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiHeader

{string} X-WP-Nonce

apiParam

{number[]} ids

apiName

CookiesOrder

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeCookiesUnassigned()

See API docs.

public routeCookiesUnassigned() : mixed
APIYes
Tags
apiHeader

{string} X-WP-Nonce

apiName

CookiesUnassigned

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeCountryBypassDownload()

See API docs.

public routeCountryBypassDownload() : mixed
APIYes
Tags
apiHeader

{string} X-WP-Nonce

apiName

CountryBypassDatabaseDownload

apiGroup

Config

apiPermission

manage_options, PRO

apiVersion

1.0.0

routeCreateCookiePolicy()

See API docs.

public routeCreateCookiePolicy(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiHeader

{string} X-WP-Nonce

apiName

CreateCookiePolicy

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeGetChecklist()

See API docs.

public routeGetChecklist() : mixed
APIYes
Tags
apiHeader

{string} X-WP-Nonce

apiName

ChecklistGet

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeGetRevisionByHash()

See API docs.

public routeGetRevisionByHash(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
since
1.3.0
apiHeader

{string} X-WP-Nonce

apiParam

{boolean} [backwardsCompatibility=true]

apiName

RevisionByHash

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeGetRevisionCurrent()

See API docs.

public routeGetRevisionCurrent() : mixed
APIYes
Tags
apiHeader

{string} X-WP-Nonce

apiName

RevisionCurrent

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeGetRevisionIndependentByHash()

See API docs.

public routeGetRevisionIndependentByHash(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
since
1.3.0
apiHeader

{string} X-WP-Nonce

apiParam

{boolean} [backwardsCompatibility=true]

apiName

RevisionIndependentByHash

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeGetRevisionSecondView()

See API docs.

public routeGetRevisionSecondView() : mixed
APIYes
Tags
apiName

RevisionSecondView

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routeMigrationDelete()

See API docs.

public routeMigrationDelete(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiParam

{string} migration

apiHeader

{string} X-WP-Nonce

apiName

DismissMigration

apiGroup

Config

apiPermission

manage_options, PRO

apiVersion

1.0.0

routeMigrationPost()

See API docs.

public routeMigrationPost(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiParam

{string} migration

apiParam

{string} action

apiHeader

{string} X-WP-Nonce

apiName

DoMigration

apiGroup

Config

apiPermission

manage_options, PRO

apiVersion

1.0.0

routeNavMenuAddLinksPost()

See API docs.

public routeNavMenuAddLinksPost(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiParam

{string} id The ID for this navigation

apiHeader

{string} X-WP-Nonce

apiName

NavMenuAddLinks

apiGroup

Config

apiPermission

manage_options, PRO

apiVersion

1.0.0

routePutChecklist()

See API docs.

public routePutChecklist(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiHeader

{string} X-WP-Nonce

apiHeader

{boolean} state

apiName

ChecklistPut

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0

routePutRevisionCurrent()

See API docs.

public routePutRevisionCurrent(WP_REST_Request $request) : mixed
APIYes
Parameters
$request : WP_REST_Request
Tags
apiHeader

{string} X-WP-Nonce

apiName

RevisionCurrentPut

apiParam

{boolean} [needs_retrigger=true] If you do not want to collect new consents for the current revision, pass false

apiGroup

Config

apiPermission

manage_options

apiVersion

1.0.0


        
On this page

Search results