Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/25/2019 11:22:00 PM (4 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-members/classes/class-bp-members-component.php

    r12451 r12463  
    462462     *
    463463     * @since 5.0.0
    464      */
    465     public function rest_api_init() {
    466         /**
    467          * As the Members component is always loaded,
    468          * let's register the Components endpoint here.
    469          */
    470         $controller = new BP_REST_Components_Endpoint();
    471         $controller->register_routes();
    472 
    473         $controller = new BP_REST_Members_Endpoint();
    474         $controller->register_routes();
    475 
    476         $controller = new BP_REST_Attachments_Member_Avatar_Endpoint();
    477         $controller->register_routes();
    478 
    479         parent::rest_api_init();
     464     *
     465     * @param array $controllers Optional. See BP_Component::rest_api_init() for
     466     *                           description.
     467     */
     468    public function rest_api_init( $controllers = array() ) {
     469        parent::rest_api_init( array(
     470            /**
     471             * As the Members component is always loaded,
     472             * let's register the Components endpoint here.
     473             */
     474            'BP_REST_Components_Endpoint',
     475            'BP_REST_Members_Endpoint',
     476            'BP_REST_Attachments_Member_Avatar_Endpoint',
     477        ) );
    480478    }
    481479}
Note: See TracChangeset for help on using the changeset viewer.