BP_REST_Blogs_Endpoint::prepare_links( BP_Blogs_Blog $blog )
Prepare links for the request.
Description
Parameters
- $blog
-
(Required) Blog object.
Return
(array)
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.
*
* @param array $links The prepared links of the REST response.
* @param BP_Blogs_Blog $blog Blog object.
*
* @since 0.1.0
*/
return apply_filters( 'bp_rest_blogs_prepare_links', $links, $blog );
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
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.