LLMS_REST_Posts_Controller::prepare_collection_items_for_response( array $objects, WP_REST_Request $request )

Prepare collection items for response.


Parameters Parameters

$objects

(array) (Required) Array of objects to be prepared for response.

$request

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


Top ↑

Return Return

(array)


Top ↑

Source Source

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

	 * Retrieve an array of objects from the result of `$this->get_objects_query()`.
	 *
	 * @since 1.0.0-beta.7
	 * @since 1.0.0-beta.9 Avoid performing an additional query, just return the already retrieved posts.
	 *
	 * @param WP_Query $query WP_Query query result.
	 * @return WP_Post[]
	 */
	protected function get_objects_from_query( $query ) {

		return $query->posts;

	}

	/**
	 * Prepare collection items for response.
	 *
	 * @since 1.0.0-beta.7
	 *


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.7 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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