BP_REST_Attachments_Member_Avatar_Endpoint::prepare_item_for_response( object $avatar, WP_REST_Request $request )
Prepares avatar data to return as an object.
Description
Parameters
- $avatar
-
(Required) Avatar object.
- $request
-
(Required) Full details about the request.
Return
(WP_REST_Response)
Source
File: bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php
457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | public function prepare_item_for_response( $avatar , $request ) { $data = array ( 'full' => $avatar ->full, 'thumb' => $avatar ->thumb, ); $context = ! empty ( $request [ 'context' ] ) ? $request [ 'context' ] : 'view' ; $data = $this ->add_additional_fields_to_object( $data , $request ); $data = $this ->filter_response_by_context( $data , $context ); // @todo add prepare_links $response = rest_ensure_response( $data ); /** * Filter a member avatar value returned from the API. * * @param WP_REST_Response $response Response. * @param WP_REST_Request $request Request used to generate the response. * @param object $avatar Avatar object. * * @since 0.1.0 */ return apply_filters( 'bp_rest_attachments_member_avatar_prepare_value' , $response , $request , $avatar ); } |
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.