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
2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 | 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.