BP_REST_Document_Endpoint::bp_documents_get_rest_field_callback( BP_Activity_Activity $activity, string $attribute )
The function to use to get documents of the activity REST Field.
Description
Parameters
- $activity
-
(Required) Activity Array.
- $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
2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 | protected function bp_documents_get_rest_field_callback( $activity , $attribute ) { $activity_id = $activity [ 'id' ]; if ( empty ( $activity_id ) ) { return ; } $document_ids = bp_activity_get_meta( $activity_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' => 'activity' ) ); } 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.