[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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: 328 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 2 files
 wp-admin/includes/plugin.php
 wp-admin/includes/plugin-install.php

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.

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.

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.

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

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.

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

return: array Item schema data.

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

return: array Collection parameters.



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