BP_REST_Media_Endpoint::prepare_item_for_response( BP_Media $media, WP_REST_Request $request )
Prepares activity data for return as an object.
Description
Parameters
- $media
-
(Required) Media data.
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response)
Source
File: bp-media/classes/class-bp-rest-media-endpoint.php
public function prepare_item_for_response( $media, $request ) { $data = array( 'id' => $media->id, 'blog_id' => $media->blog_id, 'attachment_id' => $media->attachment_id, 'user_id' => $media->user_id, 'title' => $media->title, 'album_id' => $media->album_id, 'group_id' => $media->group_id, 'activity_id' => $media->activity_id, 'privacy' => $media->privacy, 'menu_order' => $media->menu_order, 'date_created' => $media->date_created, 'attachment_data' => $media->attachment_data, 'user_email' => $media->user_email, 'user_nicename' => $media->user_nicename, 'user_login' => $media->user_login, 'display_name' => $media->display_name, ); $response = rest_ensure_response( $data ); /** * Filter an activity 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_Media $media The Media object. * * @since 0.1.0 */ return apply_filters( 'bp_rest_media_prepare_value', $response, $request, $media ); }
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.