[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/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):
  __construct()
  register_routes()
  get_items_permissions_check()
  get_items()
  prepare_item_for_response()
  get_item_schema()
  get_collection_params()
  get_transient_key()


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.

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

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

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.
since: 5.8.0
since: 6.0.0 Added 'slug' to request.

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

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

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

return: array Item schema data.
since: 5.8.0

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

return: array Collection parameters.
since: 5.8.0

get_transient_key( $query_args )   X-Ref
No description



Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1