LLMS_REST_Students_Progress_Controller::prepare_links( obj $object, WP_REST_Request $request )
Prepare links for the request.
Parameters Parameters
- $object
-
(obj) (Required) Item object.
- $request
-
(WP_REST_Request) (Required) Request object.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-students-progress-controller.php
* * @param obj $object Item object. * @param WP_REST_Request $request Request object. * @return array */ protected function prepare_links( $object, $request ) { $base = rest_url( sprintf( '/%1$s/%2$s', $this->namespace, str_replace( array( '(?P<id>[\d]+)', '(?P<post_id>[\d]+)' ), array( $object->student_id, $object->post_id ), $this->rest_base ) ) ); $post_type = get_post_type( $object->post_id ); $links = array( 'self' => array( 'href' => $base, ), 'post' => array( 'type' => $post_type, 'href' => rest_url( sprintf( '/%1$s/%2$ss/%3$d', $this->namespace, $post_type, $object->post_id ) ), ), 'student' => array( 'href' => rest_url( sprintf( '/%1$s/students/%2$d', $this->namespace, $object->student_id ) ), ),
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.14 | Added $request parameter. |
1.0.0-beta.1 | Introduced. |