[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Templates_Controller class
File Size: | 900 lines (28 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
WP_REST_Templates_Controller:: (20 methods):
__construct()
register_routes()
permissions_check()
_sanitize_template_id()
get_items_permissions_check()
get_items()
get_item_permissions_check()
get_item()
update_item_permissions_check()
update_item()
create_item_permissions_check()
create_item()
delete_item_permissions_check()
delete_item()
prepare_item_for_database()
prepare_item_for_response()
prepare_links()
get_available_actions()
get_collection_params()
get_item_schema()
Class: WP_REST_Templates_Controller - X-Ref
Base Templates REST API Controller.__construct( $post_type ) X-Ref |
Constructor. param: string $post_type Post type. since: 5.8.0 |
register_routes() X-Ref |
Registers the controllers routes. since: 5.8.0 |
permissions_check( $request ) X-Ref |
Checks if the user has permissions to make 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. since: 5.8.0 |
_sanitize_template_id( $id ) X-Ref |
Requesting this endpoint for a template like 'twentytwentytwo//home' requires using a path like /wp/v2/templates/twentytwentytwo//home. There are special cases when WordPress routing corrects the name to contain only a single slash like 'twentytwentytwo/home'. This method doubles the last slash if it's not already doubled. It relies on the template ID format {theme_name}//{template_slug} and the fact that slugs cannot contain slashes. param: string $id Template ID. return: string Sanitized template ID. since: 5.9.0 |
get_items_permissions_check( $request ) X-Ref |
Checks if a given request has access to read templates. 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. since: 5.8.0 |
get_items( $request ) X-Ref |
Returns a list of templates. param: WP_REST_Request $request The request instance. return: WP_REST_Response since: 5.8.0 |
get_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to read a single template. 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. since: 5.8.0 |
get_item( $request ) X-Ref |
Returns the given template param: WP_REST_Request $request The request instance. return: WP_REST_Response|WP_Error since: 5.8.0 |
update_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to write a single template. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has write access for the item, WP_Error object otherwise. since: 5.8.0 |
update_item( $request ) X-Ref |
Updates a single template. 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. since: 5.8.0 |
create_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to create a template. 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. since: 5.8.0 |
create_item( $request ) X-Ref |
Creates a single template. 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. since: 5.8.0 |
delete_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to delete a single template. param: WP_REST_Request $request Full details about the request. return: true|WP_Error True if the request has delete access for the item, WP_Error object otherwise. since: 5.8.0 |
delete_item( $request ) X-Ref |
Deletes a single template. 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. since: 5.8.0 |
prepare_item_for_database( $request ) X-Ref |
Prepares a single template for create or update. param: WP_REST_Request $request Request object. return: stdClass Changes to pass to wp_update_post. since: 5.8.0 |
prepare_item_for_response( $item, $request ) X-Ref |
Prepare a single template output for response param: WP_Block_Template $item Template instance. param: WP_REST_Request $request Request object. return: WP_REST_Response Response object. since: 5.8.0 since: 5.9.0 Renamed `$template` to `$item` to match parent class for PHP 8 named parameter support. |
prepare_links( $id ) X-Ref |
Prepares links for the request. param: integer $id ID. return: array Links for the given post. since: 5.8.0 |
get_available_actions() X-Ref |
Get the link relations available for the post and current user. return: string[] List of link relations. since: 5.8.0 |
get_collection_params() X-Ref |
Retrieves the query params for the posts collection. return: array Collection parameters. since: 5.8.0 since: 5.9.0 Added `'area'` and `'post_type'`. |
get_item_schema() X-Ref |
Retrieves the block type' schema, conforming to JSON Schema. return: array Item schema data. since: 5.8.0 since: 5.9.0 Added `'area'`. |
Generated: Sun Dec 22 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |