BP_REST_XProfile_Update_Endpoint::get_collection_params()
Get the query params for the XProfile updates.
Description
Return
(array)
Source
File: bp-xprofile/classes/class-bp-rest-xprofile-update-endpoint.php
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 | public function get_collection_params() { $params = parent::get_collection_params(); $params [ 'context' ][ 'default' ] = 'edit' ; $params [ 'fields' ] = array ( 'description' => __( 'Fields array with field_id, group_id, type, value and visibility_level to update the data.' , 'buddyboss' ), 'type' => 'array' , 'items' => array ( 'type' => 'object' ), 'default' => array ( array ( 'field_id' => '' , 'group_id' => '' , 'value' => '' , 'visibility_level' => '' , ), ), 'required' => true, 'properties' => array ( 'field_id' => array ( 'description' => __( 'The ID of the field the data is from.' , 'buddyboss' ), 'type' => 'integer' , 'required' => true, 'sanitize_callback' => 'absint' , 'validate_callback' => 'rest_validate_request_arg' , ), 'group_id' => array ( 'description' => __( 'ID of the profile group of fields that have profile fields' , 'buddyboss' ), 'default' => 0, 'type' => 'integer' , 'sanitize_callback' => 'absint' , 'validate_callback' => 'rest_validate_request_arg' , ), 'value' => array ( 'description' => __( 'The value of the field data.' , 'buddyboss' ), ), 'visibility_level' => array ( 'description' => __( 'Who may see the saved value for this profile field.' , 'buddyboss' ), 'default' => 'public' , 'type' => 'string' , 'enum' => array_keys ( bp_xprofile_get_visibility_levels() ), ), ), ); $params [ 'profile_group_id' ] = array ( 'description' => __( 'ID of the field group that have fields.' , 'buddyboss' ), 'default' => 0, 'type' => 'integer' , 'sanitize_callback' => 'absint' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'hide_empty_groups' ] = array ( 'description' => __( 'Whether to hide profile groups of fields that do not have any profile fields or not.' , 'buddyboss' ), 'default' => false, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'member_type' ] = array ( 'description' => __( 'Limit fields by those restricted to a given member type, or array of member types. If `$user_id` is provided, the value of `$member_type` will be overridden by the member types of the provided user. The special value of \'any\' will return only those fields that are unrestricted by member type - i.e., those applicable to any type.' , 'buddyboss' ), 'default' => array (), 'type' => 'array' , 'items' => array ( 'type' => 'string' ), 'sanitize_callback' => 'bp_rest_sanitize_member_types' , 'validate_callback' => 'bp_rest_validate_member_types' , ); $params [ 'hide_empty_fields' ] = array ( 'description' => __( 'Whether to hide profile groups of fields that do not have any profile fields or not.' , 'buddyboss' ), 'default' => false, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'fetch_fields' ] = array ( 'description' => __( 'Whether to fetch the fields for each group.' , 'buddyboss' ), 'default' => true, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'fetch_field_data' ] = array ( 'description' => __( 'Whether to fetch data for each field. Requires a $user_id.' , 'buddyboss' ), 'default' => true, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'fetch_visibility_level' ] = array ( 'description' => __( 'Whether to fetch the visibility level for each field.' , 'buddyboss' ), 'default' => true, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'exclude_groups' ] = array ( 'description' => __( 'Ensure result set excludes specific profile field groups.' , 'buddyboss' ), 'default' => array (), 'type' => 'array' , 'items' => array ( 'type' => 'integer' ), 'sanitize_callback' => 'bp_rest_sanitize_string_list' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'exclude_fields' ] = array ( 'description' => __( 'Ensure result set excludes specific profile fields.' , 'buddyboss' ), 'default' => array (), 'type' => 'array' , 'items' => array ( 'type' => 'string' ), 'sanitize_callback' => 'bp_rest_sanitize_string_list' , 'validate_callback' => 'rest_validate_request_arg' , ); $params [ 'update_meta_cache' ] = array ( 'description' => __( 'Whether to pre-fetch xprofilemeta for all retrieved groups, fields, and data.' , 'buddyboss' ), 'default' => true, 'type' => 'boolean' , 'sanitize_callback' => 'rest_sanitize_boolean' , 'validate_callback' => 'rest_validate_request_arg' , ); /** * Filters the collection query params. * * @param array $params Query params. */ return apply_filters( 'bp_rest_xprofile_update_collection_params' , $params ); } |
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.