[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

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

Defines 1 class

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.

param: WP_REST_Request $request The request instance.
return: WP_REST_Response|WP_Error

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.

_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.

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.

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

param: WP_REST_Request $request The request instance.
return: WP_REST_Response

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.

get_item( $request )   X-Ref
Returns the given template

param: WP_REST_Request $request The request instance.
return: WP_REST_Response|WP_Error

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.

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.

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.

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.

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.

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.

prepare_item_for_database( $request )   X-Ref
Prepares a single template for create or update.

param: WP_REST_Request $request Request object.
return: stdClass|WP_Error Changes to pass to wp_update_post.

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.

get_wp_templates_original_source_field( $template_object )   X-Ref
Returns the source from where the template originally comes from.

param: WP_Block_Template $template_object Template instance.
return: string                            Original source of the template one of theme, plugin, site, or user.

get_wp_templates_author_text_field( $template_object )   X-Ref
Returns a human readable text for the author of the template.

param: WP_Block_Template $template_object Template instance.
return: string                            Human readable text for the author.

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

param: integer $id ID.
return: array Links for the given post.

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 : Thu Nov 21 08:20:01 2024 Cross-referenced by PHPXref