[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Template_Autosaves_Controller class.

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

Defines 1 class

WP_REST_Template_Autosaves_Controller:: (7 methods):
  __construct()
  register_routes()
  prepare_item_for_response()
  get_item()
  get_parent()
  prepare_links()
  get_item_schema()


Class: WP_REST_Template_Autosaves_Controller  - X-Ref

Core class used to access template 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.


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

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

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

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

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.

prepare_links( $template )   X-Ref
Prepares links for the request.

return: array Links for the given post.
param: WP_Block_Template $template Template.

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

return: array Item schema data.



Generated : Thu May 9 08:20:02 2024 Cross-referenced by PHPXref