BP_REST_Document_Folder_Endpoint::get_collection_params()

Get the query params for collections.

Description

Return

(array)

Source

File: bp-document/classes/class-bp-rest-document-folder-endpoint.php

1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
public function get_collection_params() {
    $params = parent::get_collection_params();
 
    $params['order'] = array(
        'description'       => __( 'Order sort attribute ascending or descending.', 'buddyboss' ),
        'default'           => 'desc',
        'type'              => 'string',
        'enum'              => array( 'asc', 'desc' ),
        'sanitize_callback' => 'sanitize_key',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['orderby'] = array(
        'description'       => __( 'Order folders by which attribute.', 'buddyboss' ),
        'default'           => 'date_created',
        'type'              => 'string',
        'enum'              => array( 'id', 'title', 'date_created', 'user_id', 'group_id', 'privacy' ),
        'sanitize_callback' => 'sanitize_key',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['max'] = array(
        'description'       => __( 'Maximum number of results to return', 'buddyboss' ),
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['user_id'] = array(
        'description'       => __( 'Limit results to a specific user.', 'buddyboss' ),
        'default'           => 0,
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['parent'] = array(
        'description'       => __( 'A unique numeric ID for the parent Folder.', 'buddyboss' ),
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['group_id'] = array(
        'description'       => __( 'A unique numeric ID for the Group.', 'buddyboss' ),
        'type'              => 'integer',
        'sanitize_callback' => 'absint',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['privacy'] = array(
        'description'       => __( 'Privacy of the folder.', 'buddyboss' ),
        'type'              => 'array',
        'items'             => array(
            'enum' => array( 'public', 'loggedin', 'friends', 'onlyme', 'grouponly' ),
            'type' => 'string',
        ),
        'sanitize_callback' => 'bp_rest_sanitize_string_list',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['include'] = array(
        'description'       => __( 'Ensure result set includes specific folder IDs.', 'buddyboss' ),
        'default'           => array(),
        'type'              => 'array',
        'items'             => array( 'type' => 'integer' ),
        'sanitize_callback' => 'wp_parse_id_list',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['exclude'] = array(
        'description'       => __( 'Ensure result set excludes specific folder IDs.', 'buddyboss' ),
        'default'           => array(),
        'type'              => 'array',
        'items'             => array( 'type' => 'integer' ),
        'sanitize_callback' => 'wp_parse_id_list',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['count_total'] = array(
        'description' => __( 'Show total count or not.', 'buddyboss' ),
        'default'     => true,
        'type'        => 'boolean',
    );
 
    /**
     * Filters the collection query params.
     *
     * @param array $params Query params.
     */
    return apply_filters( 'bp_rest_document_folder_collection_params', $params );
}

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.