BP_REST_Media_Endpoint::bbp_media_gif_get_rest_field_callback( array $post, string $attribute )
The function to use to get medias gif for the topic REST Field.
Description
Parameters
- $post
-
(Required) WP_Post object.
- $attribute
-
(Required) The REST Field key used into the REST response.
Return
(string) The value of the REST Field to include into the REST response.
Source
File: bp-media/classes/class-bp-rest-media-endpoint.php
protected function bbp_media_gif_get_rest_field_callback( $post, $attribute ) { $p_id = $post['id']; if ( empty( $p_id ) ) { return; } $gif_data = get_post_meta( $p_id, '_gif_data', true ); if ( empty( $gif_data ) ) { return; } $preview_url = wp_get_attachment_url( $gif_data['still'] ); $video_url = wp_get_attachment_url( $gif_data['mp4'] ); $retval = array( 'preview_url' => $preview_url, 'video_url' => $video_url, 'rendered' => $this->bp_rest_media_forums_embed_gif( $p_id ), ); return $retval; }
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.