BP_REST_Activity_Controller::register_routes PHP Method

register_routes() public method

Register the plugin routes.
Since: 0.1.0
public register_routes ( )
    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()), 'schema' => array($this, 'get_public_item_schema')));
        register_rest_route($this->namespace, '/' . $this->rest_base . '/(?P<id>[\\d]+)', array(array('methods' => WP_REST_Server::READABLE, 'callback' => array($this, 'get_item'), 'permission_callback' => array($this, 'get_item_permissions_check'), 'args' => array('context' => $this->get_context_param(array('default' => 'view')))), 'schema' => array($this, 'get_public_item_schema')));
    }

Usage Example

Beispiel #1
0
/**
 * Register BuddyPress endpoints.
 *
 * @since 0.1.0
 */
function bp_rest_api_endpoints()
{
    // Requires https://wordpress.org/plugins/rest-api/
    if (!class_exists('WP_REST_Controller')) {
        return;
    }
    if (bp_is_active('activity')) {
        require_once dirname(__FILE__) . '/includes/bp-activity/classes/class-bp-activity-endpoints.php';
        $controller = new BP_REST_Activity_Controller();
        $controller->register_routes();
    }
}
All Usage Examples Of BP_REST_Activity_Controller::register_routes