LLMS_REST_Controller::get_items( WP_REST_Request $request )

Retrieves all items


Parameters Parameters

$request

(WP_REST_Request) (Required) Full details about the request.


Top ↑

Return Return

(WP_REST_Response|WP_Error) Response object on success, or WP_Error object on failure.


Top ↑

Source Source

File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-controller.php

	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.27 Don't call `rest_ensure_response()` twice, already called in `$this->prepare_item_for_response()`.
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return WP_Error|WP_REST_Response
	 */
	public function get_item( $request ) {

		$object = $this->get_object( (int) $request['id'] );
		if ( is_wp_error( $object ) ) {
			return $object;
		}

		$response = $this->prepare_item_for_response( $object, $request );

		return $response;

	}

	/**
	 * Retrieves all items.
	 *
	 * @since 1.0.0-beta.1
	 * @since 1.0.0-beta.3 Fix an issue displaying a last page for lists with 0 possible results.
	 * @since 1.0.0-beta.7 Broken into several methods so to improve abstraction.
	 * @since 1.0.0-beta.12 Return early if `prepare_collection_query_args()` is a `WP_Error`.
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function get_items( $request ) {

		$prepared = $this->prepare_collection_query_args( $request );


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.7 Broken into several methods so to improve abstraction.
1.0.0-beta.3 Fix an issue displaying a last page for lists with 0 possible results.
1.0.0-beta.12 Return early if prepare_collection_query_args() is a WP_Error.
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.