BP_REST_Media_Endpoint::bp_gif_data_update_rest_field_callback( object $object, object $value, string $attribute )
The function to use to update the Gif data’s value of the activity REST Field.
Description
Parameters
- $object
-
(Required) The BuddyPress component's object that was just created/updated during the request. (in this case the BP_Activity_Activity object).
- $value
-
(Required) The value of the REST Field to save.
- $attribute
-
(Required) The REST Field key used into the REST response.
Return
(object)
Source
File: bp-media/classes/class-bp-rest-media-endpoint.php
protected function bp_gif_data_update_rest_field_callback( $object, $value, $attribute ) { if ( 'media_gif' !== $attribute || empty( $object ) ) { return $value; } $still = $object['url']; $mp4 = $object['mp4']; if ( ! empty( $still ) && ! empty( $mp4 ) ) { $still = bp_media_sideload_attachment( $still ); $mp4 = bp_media_sideload_attachment( $mp4 ); bp_activity_update_meta( $value->id, '_gif_data', array( 'still' => $still, 'mp4' => $mp4, ) ); bp_activity_update_meta( $value->id, '_gif_raw_data', array( 'still' => $still, 'mp4' => $mp4, ) ); } return $value; }
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.