[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
REST API: WP_REST_Templates_Controller class
File Size: | 1196 lines (38 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 1 file wp-admin/includes/plugin.php |
WP_REST_Templates_Controller:: (23 methods):
__construct()
register_routes()
get_template_fallback()
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()
get_wp_templates_original_source_field()
get_wp_templates_author_text_field()
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. |
register_routes() X-Ref |
Registers the controllers routes. |
get_template_fallback( $request ) X-Ref |
Returns the fallback template for the given slug. return: WP_REST_Response|WP_Error param: WP_REST_Request $request The request instance. |
permissions_check( $request ) X-Ref |
Checks if the user has permissions to make the request. 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. |
_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. return: string Sanitized template ID. param: string $id Template ID. |
get_items_permissions_check( $request ) X-Ref |
Checks if a given request has access to read templates. 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. |
get_items( $request ) X-Ref |
Returns a list of templates. return: WP_REST_Response param: WP_REST_Request $request The request instance. |
get_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to read a single template. return: true|WP_Error True if the request has read access for the item, WP_Error object otherwise. param: WP_REST_Request $request Full details about the request. |
get_item( $request ) X-Ref |
Returns the given template return: WP_REST_Response|WP_Error param: WP_REST_Request $request The request instance. |
update_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to write a single template. return: true|WP_Error True if the request has write access for the item, WP_Error object otherwise. param: WP_REST_Request $request Full details about the request. |
update_item( $request ) X-Ref |
Updates a single template. 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. |
create_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to create a template. return: true|WP_Error True if the request has access to create items, WP_Error object otherwise. param: WP_REST_Request $request Full details about the request. |
create_item( $request ) X-Ref |
Creates a single template. 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. |
delete_item_permissions_check( $request ) X-Ref |
Checks if a given request has access to delete a single template. return: true|WP_Error True if the request has delete access for the item, WP_Error object otherwise. param: WP_REST_Request $request Full details about the request. |
delete_item( $request ) X-Ref |
Deletes a single template. 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. |
prepare_item_for_database( $request ) X-Ref |
Prepares a single template for create or update. return: stdClass|WP_Error Changes to pass to wp_update_post. param: WP_REST_Request $request Request object. |
prepare_item_for_response( $item, $request ) X-Ref |
Prepare a single template output for response return: WP_REST_Response Response object. param: WP_Block_Template $item Template instance. param: WP_REST_Request $request Request object. |
get_wp_templates_original_source_field( $template_object ) X-Ref |
Returns the source from where the template originally comes from. return: string Original source of the template one of theme, plugin, site, or user. param: WP_Block_Template $template_object Template instance. |
get_wp_templates_author_text_field( $template_object ) X-Ref |
Returns a human readable text for the author of the template. return: string Human readable text for the author. param: WP_Block_Template $template_object Template instance. |
prepare_links( $id ) X-Ref |
Prepares links for the request. return: array Links for the given post. param: integer $id ID. |
get_available_actions() X-Ref |
Get the link relations available for the post and current user. return: string[] List of link relations. |
get_collection_params() X-Ref |
Retrieves the query params for the posts collection. return: array Collection parameters. |
get_item_schema() X-Ref |
Retrieves the block type' schema, conforming to JSON Schema. return: array Item schema data. |
Generated : Sat Dec 21 08:20:01 2024 | Cross-referenced by PHPXref |