[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-includes/rest-api/endpoints/ -> class-wp-rest-search-controller.php (summary)

REST API: WP_REST_Search_Controller class

File Size: 364 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

WP_REST_Search_Controller:: (9 methods):
  __construct()
  register_routes()
  get_items_permission_check()
  get_items()
  prepare_item_for_response()
  get_item_schema()
  get_collection_params()
  sanitize_subtypes()
  get_search_handler()


Class: WP_REST_Search_Controller  - X-Ref

Core class to search through all WordPress content via the REST API.

__construct( array $search_handlers )   X-Ref
Constructor.

param: array $search_handlers List of search handlers to use in the controller. Each search
since: 5.0.0

register_routes()   X-Ref
Registers the routes for the objects of the controller.

since: 5.0.0

get_items_permission_check( $request )   X-Ref
Checks if a given request has access to search content.

param: WP_REST_Request $request Full details about the request.
since: 5.0.0
return: true|WP_Error True if the request has search access, WP_Error object otherwise.

get_items( $request )   X-Ref
Retrieves a collection of search results.

param: WP_REST_Request $request Full details about the request.
since: 5.0.0
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

prepare_item_for_response( $id, $request )   X-Ref
Prepares a single search result for response.

param: int             $id      ID of the item to prepare.
param: WP_REST_Request $request Request object.
since: 5.0.0
return: WP_REST_Response Response object.

get_item_schema()   X-Ref
Retrieves the item schema, conforming to JSON Schema.

since: 5.0.0
return: array Item schema data.

get_collection_params()   X-Ref
Retrieves the query params for the search results collection.

since: 5.0.0
return: array Collection parameters.

sanitize_subtypes( $subtypes, $request, $parameter )   X-Ref
Sanitizes the list of subtypes, to ensure only subtypes of the passed type are included.

param: string|array    $subtypes  One or more subtypes.
param: WP_REST_Request $request   Full details about the request.
param: string          $parameter Parameter name.
since: 5.0.0
return: array|WP_Error List of valid subtypes, or WP_Error object on failure.

get_search_handler( $request )   X-Ref
Gets the search handler to handle the current request.

param: WP_REST_Request $request Full details about the request.
since: 5.0.0
return: WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure.



Generated: Mon Sep 23 01:00:03 2019 Cross-referenced by PHPXref 0.7.1