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.


Top ↑

Return Return

(array)


Top ↑

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 ) ),
			),

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.14 Added $request parameter.
1.0.0-beta.1 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.