BP_REST_Mention_Endpoint::prepare_item_for_response( BP_Groups_Group $item, WP_REST_Request $request )
Prepares group data for return as an object.
Description
Parameters
- $item
-
(Required) Group object.
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response)
Source
File: bp-core/classes/class-bp-rest-mention-endpoint.php
public function prepare_item_for_response( $item, $request ) { $data = array( 'id' => $item->user_id, 'display_id' => $item->ID, 'user_nicename' => $item->user_nicename, 'name' => $item->name, 'image' => $item->image, ); $data = $this->add_additional_fields_to_object( $data, $request ); $response = rest_ensure_response( $data ); $response->add_links( $this->prepare_links( $item ) ); /** * Filter a group 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 BP_Groups_Group $item Group object. * * @since 0.1.0 */ return apply_filters( 'bp_rest_member_prepare_value', $response, $request, $item ); }
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.