Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/25/2019 11:22:00 PM (5 years ago)
Author:
imath
Message:

Improve the way BP REST API Controllers are loaded

Introduce a new filter to allow site owners to eventually disable one or more BP REST API Controllers.

See #7156

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-xprofile/classes/class-bp-xprofile-component.php

    r12451 r12463  
    495495     *
    496496     * @since 5.0.0
    497      */
    498     public function rest_api_init() {
    499         $controller = new BP_REST_XProfile_Fields_Endpoint();
    500         $controller->register_routes();
    501 
    502         $controller = new BP_REST_XProfile_Field_Groups_Endpoint();
    503         $controller->register_routes();
    504 
    505         $controller = new BP_REST_XProfile_Data_Endpoint();
    506         $controller->register_routes();
    507 
    508         parent::rest_api_init();
     497     *
     498     * @param array $controllers Optional. See BP_Component::rest_api_init() for
     499     *                           description.
     500     */
     501    public function rest_api_init( $controllers = array() ) {
     502        parent::rest_api_init( array(
     503            'BP_REST_XProfile_Fields_Endpoint',
     504            'BP_REST_XProfile_Field_Groups_Endpoint',
     505            'BP_REST_XProfile_Data_Endpoint',
     506        ) );
    509507    }
    510508}
Note: See TracChangeset for help on using the changeset viewer.