[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

REST API: WP_REST_Block_Directory_Controller class

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

Defines 1 class

WP_REST_Block_Directory_Controller:: (9 methods):
  __construct()
  register_routes()
  get_items_permissions_check()
  get_items()
  prepare_item_for_response()
  prepare_links()
  find_plugin_for_slug()
  get_item_schema()
  get_collection_params()


Class: WP_REST_Block_Directory_Controller  - X-Ref

Controller which provides REST endpoint for the blocks.

__construct()   X-Ref
Constructs the controller.


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


get_items_permissions_check( $request )   X-Ref
Checks whether a given request has permission to install and activate plugins.

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

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

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.
since: 5.5.0

prepare_item_for_response( $item, $request )   X-Ref
Parse block metadata for a block, and prepare it for an API response.

param: array           $item    The plugin metadata.
param: WP_REST_Request $request Request object.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
since: 5.5.0
since: 5.9.0 Renamed `$plugin` to `$item` to match parent class for PHP 8 named parameter support.

prepare_links( $plugin )   X-Ref
Generates a list of links to include in the response for the plugin.

param: array $plugin The plugin data from WordPress.org.
return: array
since: 5.5.0

find_plugin_for_slug( $slug )   X-Ref
Finds an installed plugin for the given slug.

param: string $slug The WordPress.org directory slug for a plugin.
return: string The plugin file found matching it.
since: 5.5.0

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

return: array Item schema data.
since: 5.5.0

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

return: array Collection parameters.
since: 5.5.0



Generated: Tue Dec 3 01:00:02 2024 Cross-referenced by PHPXref 0.7.1