BP_REST_Document_Endpoint::prepare_item_for_response( BP_Document $document, WP_REST_Request $request )
Prepares document data for return as an object.
Description
Parameters
- $document
-
(Required) Document data.
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response)
Source
File: bp-document/classes/class-bp-rest-document-endpoint.php
public function prepare_item_for_response( $document, $request ) { $data = $this->document_get_prepare_response( $document, $request ); $data = $this->add_additional_fields_to_object( $data, $request ); $response = rest_ensure_response( $data ); /** * Filter an document value returned from the API. * * @since 0.1.0 * * @param WP_REST_Request $request Request used to generate the response. * @param BP_Document $document The Document object. * * @param WP_REST_Response $response The response data. */ return apply_filters( 'bp_rest_document_prepare_value', $response, $request, $document ); }
Changelog
Version | Description |
---|---|
0.1.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.