[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

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

Defines 1 class

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.

since: 5.8.0
param: string $post_type Post type.

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.

return: true|WP_Error True if the request has read access, WP_Error object otherwise.
since: 5.8.0
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.
since: 5.9.0
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.
since: 5.8.0
param: WP_REST_Request $request Full details about the request.

get_items( $request )   X-Ref
Returns a list of templates.

return: WP_REST_Response
since: 5.8.0
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.
since: 5.8.0
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
since: 5.8.0
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.
since: 5.8.0
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.
since: 5.8.0
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.
since: 5.8.0
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.
since: 5.8.0
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.
since: 5.8.0
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.
since: 5.8.0
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 Changes to pass to wp_update_post.
since: 5.8.0
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.
since: 5.8.0
since: 5.9.0 Renamed `$template` to `$item` to match parent class for PHP 8 named parameter support.
param: WP_Block_Template $item    Template instance.
param: WP_REST_Request   $request Request object.

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

return: array Links for the given post.
since: 5.8.0
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.
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: Mon Jun 27 01:00:02 2022 Cross-referenced by PHPXref 0.7.1