Docs: Improve documentation for `WP_REST_Attachments_Controller`.
This adds a missing DocBlock for `::register_routes()` and parameter descriptions for `::post_process_item()`. Includes minor documenation fixes in other REST API classes for consistency. Props dkarfa, mukesh27, SergeyBiryukov. Fixes #48841. Built from https://develop.svn.wordpress.org/trunk@47391 git-svn-id: http://core.svn.wordpress.org/trunk@47178 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
eb524c0b38
commit
cbe5f9963a
|
@ -16,6 +16,13 @@
|
|||
*/
|
||||
class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||
|
||||
/**
|
||||
* Registers the routes for attachments.
|
||||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @see register_rest_route()
|
||||
*/
|
||||
public function register_routes() {
|
||||
parent::register_routes();
|
||||
register_rest_route(
|
||||
|
@ -344,8 +351,8 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
|||
*
|
||||
* @since 5.3.0
|
||||
*
|
||||
* @param WP_REST_Request $request
|
||||
* @return WP_REST_Response|WP_Error
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return WP_REST_Response|WP_Error Response object on success, WP_Error object on failure.
|
||||
*/
|
||||
public function post_process_item( $request ) {
|
||||
switch ( $request['action'] ) {
|
||||
|
|
|
@ -73,7 +73,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Registers routes for autosaves.
|
||||
* Registers the routes for autosaves.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
|
@ -151,7 +151,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
|||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
|
@ -249,7 +249,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
|||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise.
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
|
@ -284,7 +284,7 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
|||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
|
|
|
@ -30,6 +30,8 @@ class WP_REST_Block_Renderer_Controller extends WP_REST_Controller {
|
|||
* Registers the necessary REST API routes, one for each dynamic block.
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @see register_rest_route()
|
||||
*/
|
||||
public function register_routes() {
|
||||
$block_types = WP_Block_Type_Registry::get_instance()->get_all_registered();
|
||||
|
|
|
@ -40,6 +40,8 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
|||
* Registers the routes for the objects of the controller.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @see register_rest_route()
|
||||
*/
|
||||
public function register_routes() {
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ abstract class WP_REST_Controller {
|
|||
* Registers the routes for the objects of the controller.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @see register_rest_route()
|
||||
*/
|
||||
public function register_routes() {
|
||||
_doing_it_wrong(
|
||||
|
@ -57,7 +59,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
|
@ -74,7 +76,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
|
@ -91,7 +93,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_item_permissions_check( $request ) {
|
||||
|
@ -108,7 +110,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
|
@ -125,7 +127,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has access to create items, WP_Error object otherwise.
|
||||
*/
|
||||
public function create_item_permissions_check( $request ) {
|
||||
|
@ -142,7 +144,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
|
@ -159,7 +161,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has access to update the item, WP_Error object otherwise.
|
||||
*/
|
||||
public function update_item_permissions_check( $request ) {
|
||||
|
@ -176,7 +178,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
|
@ -193,7 +195,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has access to delete the item, WP_Error object otherwise.
|
||||
*/
|
||||
public function delete_item_permissions_check( $request ) {
|
||||
|
@ -210,7 +212,7 @@ abstract class WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function delete_item( $request ) {
|
||||
|
|
|
@ -61,7 +61,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Registers routes for revisions based on post types supporting revisions.
|
||||
* Registers the routes for revisions based on post types supporting revisions.
|
||||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
|
@ -160,7 +160,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return true|WP_Error True if the request has read access, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_items_permissions_check( $request ) {
|
||||
|
@ -214,7 +214,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
|
@ -363,7 +363,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @param WP_REST_Request $request Full details about the request.
|
||||
* @return bool|WP_Error True if the request has read access for the item, WP_Error object otherwise.
|
||||
*/
|
||||
public function get_item_permissions_check( $request ) {
|
||||
|
@ -375,7 +375,7 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
|||
*
|
||||
* @since 4.7.0
|
||||
*
|
||||
* @param WP_REST_Request $request Full data about the request.
|
||||
* @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.
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.4-beta3-47390';
|
||||
$wp_version = '5.4-beta3-47391';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue