BP_REST_Activity_Endpoint::prepare_activity_comments( array $comments, WP_REST_Request $request )

Prepare activity comments.


Description Description


Parameters Parameters

$comments

(Required) Comments.

$request

(Required) Full details about the request.


Top ↑

Return Return

(array) An array of activity comments.


Top ↑

Source Source

File: bp-activity/classes/class-bp-rest-activity-endpoint.php

	protected function prepare_activity_comments( $comments, $request ) {
		$data = array();

		if ( empty( $comments ) ) {
			return $data;
		}

		foreach ( $comments as $comment ) {
			$data[] = $this->prepare_response_for_collection(
				$this->prepare_item_for_response( $comment, $request )
			);
		}

		/**
		 * Filter activity comments returned from the API.
		 *
		 * @since 5.0.0
		 *
		 * @param array           $data     An array of activity comments.
		 * @param array           $comments Comments.
		 * @param WP_REST_Request $request  Request used to generate the response.
		 */
		return apply_filters( 'bp_rest_activity_prepare_comments', $data, $comments, $request );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.