[ Index ]

PHP Cross Reference of WordPress




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

Block Pattern Directory REST API: WP_REST_Pattern_Directory_Controller class

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

Defines 1 class

WP_REST_Pattern_Directory_Controller:: (8 methods):

Class: WP_REST_Pattern_Directory_Controller  - X-Ref

Controller which provides REST endpoint for block patterns.

This simply proxies the endpoint at http://api.wordpress.org/patterns/1.0/. That isn't necessary for
functionality, but is desired for privacy. It prevents api.wordpress.org from knowing the user's IP address.

__construct()   X-Ref
Constructs the controller.

since: 5.8.0

register_routes()   X-Ref
Registers the necessary REST API routes.

since: 5.8.0

get_items_permissions_check( $request )   X-Ref
Checks whether a given request has permission to view the local block pattern directory.

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

get_items( $request )   X-Ref
Search and retrieve block patterns metadata

since: 5.8.0
since: 6.0.0 Added 'slug' to request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: WP_REST_Request $request Full details about the request.

prepare_item_for_response( $item, $request )   X-Ref
Prepare a raw block pattern before it gets output in a REST API response.

since: 5.8.0
since: 5.9.0 Renamed `$raw_pattern` to `$item` to match parent class for PHP 8 named parameter support.
return: WP_REST_Response
param: object          $item    Raw pattern from api.wordpress.org, before any changes.
param: WP_REST_Request $request Request object.

get_item_schema()   X-Ref
Retrieves the block pattern's schema, conforming to JSON Schema.

since: 5.8.0
return: array Item schema data.

get_collection_params()   X-Ref
Retrieves the search parameters for the block pattern's collection.

since: 5.8.0
return: array Collection parameters.

get_transient_key( $query_args )   X-Ref
No description

Generated: Wed Jun 29 01:00:03 2022 Cross-referenced by PHPXref 0.7.1