BP_REST_Components_Endpoint::register_routes()
Register the component routes.
Description Description
Source Source
File: bp-core/classes/class-bp-rest-components-endpoint.php
public function register_routes() { register_rest_route( $this->namespace, '/' . $this->rest_base, array( array( 'methods' => WP_REST_Server::READABLE, 'callback' => array( $this, 'get_items' ), 'permission_callback' => array( $this, 'get_items_permissions_check' ), 'args' => $this->get_collection_params(), ), array( 'methods' => WP_REST_Server::EDITABLE, 'callback' => array( $this, 'update_item' ), 'permission_callback' => array( $this, 'update_item_permissions_check' ), 'args' => array( 'name' => array( 'type' => 'string', 'required' => true, 'description' => __( 'Name of the component.', 'buddypress' ), 'arg_options' => array( 'sanitize_callback' => 'sanitize_key', ), ), 'action' => array( 'description' => __( 'Whether to activate or deactivate the component.', 'buddypress' ), 'type' => 'string', 'enum' => array( 'activate', 'deactivate' ), 'required' => true, 'arg_options' => array( 'sanitize_callback' => 'sanitize_key', ), ), ), ), 'schema' => array( $this, 'get_item_schema' ), ) ); }
Changelog Changelog
Version | Description |
---|---|
5.0.0 | Introduced. |