[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Search_Controller class

File Size: 408 lines (11 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

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


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.
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.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

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

param: int|string      $item    ID of the item to prepare.
param: WP_REST_Request $request Request object.
return: WP_REST_Response Response object.

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

return: array Item schema data.

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

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.
return: string[]|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.
return: WP_REST_Search_Handler|WP_Error Search handler for the request type, or WP_Error object on failure.



Generated : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref