BP_REST_XProfile_Search_Form_Fields_Endpoint::get_items( WP_REST_Request $request )

Retrieve XProfile search form fields.

Description

Parameters

$request

(Required) Full data about the request.

Return

(WP_REST_Response)

Source

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

67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
public function get_items( $request ) {
 
    if ( empty( $request['form_id'] ) ) {
        $args['form_id'] = bp_profile_search_main_form();
    }
 
    /**
     * Filter the query arguments for the request.
     *
     * @param array $args Key value array of query var to query value.
     * @param WP_REST_Request $request The request sent to the API.
     *
     * @since 0.1.0
     */
    $args = apply_filters( 'bp_rest_xprofile_search_form_fields_get_items_query_args', $args, $request );
 
    // Actually, query it.
    $f = bp_profile_search_escaped_form_data( $args['form_id'] );
 
    $response = rest_ensure_response( $f );
 
    /**
     * Fires after a list of field are fetched via the REST API.
     *
     * @param array $field_groups Fetched field groups.
     * @param WP_REST_Response $response The response data.
     * @param WP_REST_Request $request The request sent to the API.
     *
     * @since 0.1.0
     */
    do_action( 'bp_rest_xprofile_search_form_fields_get_items', $response, $request );
 
    return $response;
}

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.