BP_REST_Components_Endpoint::get_collection_params()

Get the query params for collections.

Description

Return

(array)

Source

File: bp-core/classes/class-bp-rest-components-endpoint.php

508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
public function get_collection_params() {
    $params                       = parent::get_collection_params();
    $params['context']['default'] = 'view';
 
    $params['status'] = array(
        'description'       => __( 'Limit result set to items with a specific status.', 'buddyboss' ),
        'default'           => 'all',
        'type'              => 'string',
        'enum'              => array( 'all', 'active', 'inactive' ),
        'sanitize_callback' => 'sanitize_key',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    $params['type'] = array(
        'description'       => __( 'Limit result set to items with a specific type.', 'buddyboss' ),
        'default'           => 'all',
        'type'              => 'string',
        'enum'              => array( 'all', 'optional', 'retired', 'required' ),
        'sanitize_callback' => 'sanitize_key',
        'validate_callback' => 'rest_validate_request_arg',
    );
 
    /**
     * Filters the collection query params.
     *
     * @param array $params Query params.
     */
    return apply_filters( 'bp_rest_components_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.