BP_REST_Document_Endpoint::bp_documents_get_rest_field_callback_messages( array $data, string $attribute )
The function to use to get documents of the messages REST Field.
Description
Parameters
- $data
-
(Required) The message value for the REST response.
- $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-document/classes/class-bp-rest-document-endpoint.php
2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 | protected function bp_documents_get_rest_field_callback_messages( $data , $attribute ) { $message_id = $data [ 'id' ]; if ( empty ( $message_id ) ) { return ; } $document_ids = bp_messages_get_meta( $message_id , 'bp_document_ids' , true ); $document_ids = trim( $document_ids ); $document_ids = explode ( ',' , $document_ids ); if ( empty ( $document_ids ) ) { return ; } $documents = $this ->assemble_response_data( array ( 'document_ids' => $document_ids ) ); if ( empty ( $documents [ 'documents' ] ) ) { return ; } $retval = array (); foreach ( $documents [ 'documents' ] as $document ) { $retval [] = $this ->document_get_prepare_response( $document , array ( 'support' => 'message' ) ); } 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.