[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
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 |
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. since: 5.0.0 param: string $parent_post_type Post type of the parent. |
register_routes() X-Ref |
Registers the routes for autosaves. since: 5.0.0 |
get_parent( $parent_id ) X-Ref |
Get the parent post. since: 5.0.0 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. since: 5.0.0 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. since: 5.0.0 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. since: 5.0.0 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. since: 5.0.0 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. since: 5.0.0 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. since: 5.0.0 return: array Item schema data. |
create_post_autosave( $post_data ) X-Ref |
Creates autosave for the specified post. From wp-admin/post.php. since: 5.0.0 param: array $post_data Associative array containing the post 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. since: 5.0.0 since: 5.9.0 Renamed `$post` to `$item` to match parent class for PHP 8 named parameter support. 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. since: 5.0.0 return: array Collection parameters. |
Generated: Sun Oct 13 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |