BP_REST_XProfile_Fields_Endpoint::prepare_links( BP_XProfile_Field $field )

Prepare links for the request.

Description

Parameters

$field

(Required) XProfile field object.

Return

(array)

Source

File: bp-xprofile/classes/class-bp-rest-xprofile-fields-endpoint.php

954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
protected function prepare_links( $field ) {
    $base = sprintf( '/%s/%s/', $this->namespace, $this->rest_base );
 
    // Entity meta.
    $links = array(
        'self'       => array(
            'href' => rest_url( $base . $field->id ),
        ),
        'collection' => array(
            'href' => rest_url( $base ),
        ),
    );
 
    /**
     * Filter links prepared for the REST response.
     *
     * @param array $links The prepared links of the REST response.
     * @param BP_XProfile_Field $field XProfile field object.
     *
     * @since 0.1.0
     */
    return apply_filters( 'bp_rest_xprofile_fields_prepare_links', $links, $field );
}

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.