BP_REST_Components_Endpoint::prepare_item_for_response( array $component, WP_REST_Request $request )
Prepares component data for return as an object.
Description
Parameters
- $component
-
(Required) The component and its values.
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response)
Source
File: bp-core/classes/class-bp-rest-components-endpoint.php
public function prepare_item_for_response( $component, $request ) { $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; $data = $this->add_additional_fields_to_object( $component, $request ); $data = $this->filter_response_by_context( $data, $context ); // @todo add prepare_links $response = rest_ensure_response( $data ); /** * Filter a component value returned from the API. * * @param WP_REST_Response $response The Response data. * @param WP_REST_Request $request Request used to generate the response. * @param array $component The component and its values. * * @since 0.1.0 */ return apply_filters( 'bp_rest_components_prepare_value', $response, $request, $component ); }
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.