[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Autosaves_Controller class.

File Size: 497 lines (15 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 wp-admin/includes/post.php

Defines 1 class

WP_REST_Autosaves_Controller:: (12 methods):
  __construct()
  register_routes()
  get_parent()
  get_items_permissions_check()
  create_item_permissions_check()
  create_item()
  get_item()
  get_items()
  get_item_schema()
  create_post_autosave()
  prepare_item_for_response()
  get_collection_params()


Class: WP_REST_Autosaves_Controller  - X-Ref

Core class used to access autosaves via the REST API.

__construct( $parent_post_type )   X-Ref
Constructor.

param: string $parent_post_type Post type of the parent.

register_routes()   X-Ref
Registers the routes for autosaves.


get_parent( $parent_id )   X-Ref
Get the parent post.

param: int $parent_id Supplied ID.
return: WP_Post|WP_Error Post object if ID is valid, WP_Error otherwise.

get_items_permissions_check( $request )   X-Ref
Checks if a given request has access to get autosaves.

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.

create_item_permissions_check( $request )   X-Ref
Checks if a given request has access to create an autosave revision.

Autosave revisions inherit permissions from the parent post,
check if the current user has permission to edit the post.

param: WP_REST_Request $request Full details about the request.
return: true|WP_Error True if the request has access to create the item, WP_Error object otherwise.

create_item( $request )   X-Ref
Creates, updates or deletes an autosave revision.

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.

get_item( $request )   X-Ref
Get the autosave, if the ID is valid.

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.

get_items( $request )   X-Ref
Gets a collection of autosaves using wp_get_post_autosave.

Contains the user's autosave, for empty if it doesn't exist.

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.

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

return: array Item schema data.

create_post_autosave( $post_data, array $meta = array()   X-Ref
Creates autosave for the specified post.

From wp-admin/post.php.

param: array $post_data Associative array containing the post data.
param: array $meta      Associative array containing the post meta data.
return: mixed The autosave revision ID or WP_Error.

prepare_item_for_response( $item, $request )   X-Ref
Prepares the revision for the REST response.

param: WP_Post         $item    Post revision object.
param: WP_REST_Request $request Request object.
return: WP_REST_Response Response object.

get_collection_params()   X-Ref
Retrieves the query params for the autosaves collection.

return: array Collection parameters.



Generated : Sat Apr 20 08:20:01 2024 Cross-referenced by PHPXref