BP_REST_Blogs_Endpoint::prepare_links( stdClass $blog )

Prepare links for the request.


Parameters Parameters

$blog

(stdClass) (Required) Blog object.


Top ↑

Return Return

(array)


Source Source

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

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

		// Entity meta.
		$links = array(
			'self'       => array(
				'href' => rest_url( $url ),
			),
			'collection' => array(
				'href' => rest_url( $base ),
			),
			'user'      => array(
				'href'       => rest_url( bp_rest_get_user_url( $blog->admin_user_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 stdClass $blog  Blog object.
		 */
		return apply_filters( 'bp_rest_blogs_prepare_links', $links, $blog );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
6.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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