[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

REST API: WP_REST_Autosaves_Controller class.

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

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

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

since: 5.0.0

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

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

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

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

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.

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

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

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.0.0

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

return: WP_Post|WP_Error Revision post object if ID is valid, WP_Error otherwise.
param: WP_REST_Request $request Full details about the request.
since: 5.0.0

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.

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.0.0

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

return: array Item schema data.
since: 5.0.0

create_post_autosave( $post_data )   X-Ref
Creates autosave for the specified post.

From wp-admin/post.php.

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

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

return: WP_REST_Response Response object.
param: WP_Post         $item    Post revision object.
param: WP_REST_Request $request Request object.
since: 5.0.0
since: 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support.

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

return: array Collection parameters.
since: 5.0.0



Generated: Sat Apr 27 01:00:02 2024 Cross-referenced by PHPXref 0.7.1