[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

REST API: WP_REST_Controller class

File Size: 672 lines (20 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.

since: 4.7.0

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

since: 4.7.0
param: WP_REST_Request $request Full data about the request.
return: true|WP_Error True if the request has read access, WP_Error object otherwise.

get_items( $request )   X-Ref
Retrieves a collection of items.

since: 4.7.0
param: WP_REST_Request $request Full data about the request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

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

since: 4.7.0
param: WP_REST_Request $request Full data 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
Retrieves one item from the collection.

since: 4.7.0
param: WP_REST_Request $request Full data 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 items.

since: 4.7.0
param: WP_REST_Request $request Full data 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 one item from the collection.

since: 4.7.0
param: WP_REST_Request $request Full data about the request.
return: WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.

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

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

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

since: 4.7.0
param: WP_REST_Request $request Full data 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 specific item.

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

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

since: 4.7.0
param: WP_REST_Request $request Full data 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 one item for create or update operation.

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

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

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

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

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

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

since: 4.7.0
param: array  $data    Response data to fiter.
param: string $context Context defined in the schema.
return: array Filtered response.

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

since: 4.7.0
return: array Item schema data.

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

since: 4.7.0
return: array Public item schema data.

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

since: 4.7.0
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.

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

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

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

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

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

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.

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

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

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

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

since: 4.7.0
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.

since: 4.9.6
param: WP_REST_Request $request Full details about the request.
return: array Fields to be included in the response.

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

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

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



Generated: Mon Nov 18 01:00:04 2019 Cross-referenced by PHPXref 0.7.1