BP_REST_Groups_Endpoint::prepare_links( BP_Groups_Group $group )

Prepare links for the request.

Description

Parameters

$group

(Required) Group object.

Return

(array)

Source

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

984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
protected function prepare_links( $group ) {
    $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
 
    // Entity meta.
    $links = array(
        'self'       => array(
            'href' => rest_url( $base . $group->id ),
        ),
        'collection' => array(
            'href' => rest_url( $base ),
        ),
        'user'       => array(
            'href'       => rest_url( bp_rest_get_user_url( $group->creator_id ) ),
            'embeddable' => true,
        ),
    );
 
    /**
     * Filter links prepared for the REST response.
     *
     * @param array           $links The prepared links of the REST response.
     * @param BP_Groups_Group $group Group object.
     *
     * @since 0.1.0
     */
    return apply_filters( 'bp_rest_groups_prepare_links', $links, $group );
}

Changelog

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.