BP_REST_Group_Membership_Endpoint::prepare_links( BP_Groups_Member $group_member )

Prepare links for the request.


Parameters Parameters

$group_member

(BP_Groups_Member) (Required) Group member object.


Top ↑

Return Return

(array)


Source Source

File: bp-groups/classes/class-bp-rest-group-membership-endpoint.php

	protected function prepare_links( $group_member ) {
		$base = sprintf( '/%s/%s', $this->namespace, $this->rest_base );

		// Entity meta.
		$links = array(
			'self'       => array(
				'href' => rest_url( bp_rest_get_user_url( $group_member->user_id ) ),
			),
			'collection' => array(
				'href' => rest_url( sprintf( '/%s/%d/members', $base, $group_member->group_id ) ),
			),
			'group'      => array(
				'href'       => rest_url( sprintf( '/%s/%d', $base, $group_member->group_id ) ),
				'embeddable' => true,
			),
		);

		/**
		 * Filter links prepared for the REST response.
		 *
		 * @since 5.0.0
		 *
		 * @param array $          links         The prepared links of the REST response.
		 * @param BP_Groups_Member $group_member Group member object.
		 */
		return apply_filters( 'bp_rest_group_members_prepare_links', $links, $group_member );
	}


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.