[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

title

Body

[close]

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

REST API: WP_REST_Controller class

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

Defines 27 functions

  register_routes()
  get_items_permissions_check()
  get_items()
  get_item_permissions_check()
  get_item()
  create_item_permissions_check()
  create_item()
  update_item_permissions_check()
  update_item()
  delete_item_permissions_check()
  delete_item()
  prepare_item_for_database()
  prepare_item_for_response()
  prepare_response_for_collection()
  filter_response_by_context()
  get_item_schema()
  get_public_item_schema()
  get_collection_params()
  get_context_param()
  add_additional_fields_to_object()
  update_additional_fields_for_object()
  add_additional_fields_schema()
  get_additional_fields()
  get_object_type()
  get_fields_for_response()
  get_endpoint_args_for_item_schema()
  sanitize_slug()

Functions
Functions that are not part of a class:

register_routes()   X-Ref
Registers the routes for the objects of the controller.


get_items_permissions_check( $request )   X-Ref
Checks if a given request has access to get items.

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
Retrieves a collection of items.

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.

get_item_permissions_check( $request )   X-Ref
Checks if a given request has access to get a specific item.

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
Retrieves one item from the collection.

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

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 one item from the collection.

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.

update_item_permissions_check( $request )   X-Ref
Checks if a given request has access to update a specific item.

return: true|WP_Error True if the request has access to update the item, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.

update_item( $request )   X-Ref
Updates one item from the collection.

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 specific item.

return: true|WP_Error True if the request has access to delete the item, WP_Error object otherwise.
param: WP_REST_Request $request Full details about the request.

delete_item( $request )   X-Ref
Deletes one item from the collection.

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 one item for create or update operation.

return: object|WP_Error The prepared item, or WP_Error object on failure.
param: WP_REST_Request $request Request object.

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

return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
param: mixed           $item    WordPress representation of the item.
param: WP_REST_Request $request Request object.

prepare_response_for_collection( $response )   X-Ref
Prepares a response for insertion into a collection.

return: array|mixed Response data, ready for insertion into collection data.
param: WP_REST_Response $response Response object.

filter_response_by_context( $response_data, $context )   X-Ref
Filters a response based on the context defined in the schema.

return: array Filtered response.
param: array  $response_data Response data to filter.
param: string $context       Context defined in the schema.

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

return: array Item schema data.

get_public_item_schema()   X-Ref
Retrieves the item's schema for display / public consumption purposes.

return: array Public item schema data.

get_collection_params()   X-Ref
Retrieves the query params for the collections.

return: array Query parameters for the collection.

get_context_param( $args = array()   X-Ref
Retrieves the magical context param.

Ensures consistent descriptions between endpoints, and populates enum from schema.

return: array Context parameter details.
param: array $args Optional. Additional arguments for context parameter. Default empty array.

add_additional_fields_to_object( $response_data, $request )   X-Ref
Adds the values from additional fields to a data object.

return: array Modified data object with additional fields.
param: array           $response_data Prepared response array.
param: WP_REST_Request $request       Full details about the request.

update_additional_fields_for_object( $data_object, $request )   X-Ref
Updates the values of additional fields added to a data object.

return: true|WP_Error True on success, WP_Error object if a field cannot be updated.
param: object          $data_object Data model like WP_Term or WP_Post.
param: WP_REST_Request $request     Full details about the request.

add_additional_fields_schema( $schema )   X-Ref
Adds the schema from additional fields to a schema array.

The type of object is inferred from the passed schema.

return: array Modified Schema array.
param: array $schema Schema array.

get_additional_fields( $object_type = null )   X-Ref
Retrieves all of the registered additional fields for a given object-type.

return: array Registered additional fields (if any), empty array if none or if the object type
param: string $object_type Optional. The object type.

get_object_type()   X-Ref
Retrieves the object type this controller is responsible for managing.

return: string Object type for the controller.

get_fields_for_response( $request )   X-Ref
Gets an array of fields to be included on the response.

Included fields are based on item schema and `_fields=` request argument.

return: string[] Fields to be included in the response.
param: WP_REST_Request $request Full details about the request.

get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE )   X-Ref
No description

sanitize_slug( $slug )   X-Ref
Sanitizes the slug value.

return: string Sanitized value for the slug.
param: string $slug Slug value passed in request.



Generated : Thu Apr 25 08:20:02 2024 Cross-referenced by PHPXref