LLMS_REST_Courses_Controller::register_routes()
Register routes.
Contents
Return Return
(void)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-courses-controller.php
* @since 1.0.0-beta.27 Call parent constructor.
*
* @return void
*/
public function __construct() {
parent::__construct();
$this->enrollments_controller = new LLMS_REST_Enrollments_Controller();
$this->enrollments_controller->set_collection_params( $this->get_enrollments_collection_params() );
$this->sections_controller = new LLMS_REST_Sections_Controller( '' );
$this->sections_controller->set_collection_params( $this->get_course_content_collection_params() );
}
/**
* Register routes.
*
* @since 1.0.0-beta.1
*
* @return void
*/
public function register_routes() {
parent::register_routes();
register_rest_route(
$this->namespace,
'/' . $this->rest_base . '/(?P<id>[\d]+)/enrollments',
array(
'args' => array(
'id' => array(
'description' => __( 'Unique Course Identifier. The WordPress Post ID', 'lifterlms' ),
'type' => 'integer',
),
),
array(
'methods' => WP_REST_Server::READABLE,
'callback' => array( $this->enrollments_controller, 'get_items' ),
'permission_callback' => array( $this->enrollments_controller, 'get_items_permissions_check' ),
'args' => $this->enrollments_controller->get_collection_params(),
),
'schema' => array( $this->enrollments_controller, 'get_public_item_schema' ),
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 1.0.0-beta.1 | Introduced. |