LLMS_REST_Controller::prepare_item_for_response( obj $object, WP_REST_Request $request )

Prepares a single object for response.


Parameters Parameters

$object

(obj) (Required) Raw object from database.

$request

(WP_REST_Request) (Required) Request object.


Top ↑

Return Return

(WP_Error|WP_REST_Response)


Top ↑

Source Source

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

	 * @return array
	 */
	public function get_item_schema() {

		if ( isset( $this->schema ) ) {
			// Additional fields are not cached in the schema, @see https://core.trac.wordpress.org/ticket/47871#comment:5.
			return $this->add_additional_fields_schema( $this->schema );
		}

		$schema = $this->get_item_schema_base();

		// Add custom fields registered via `register_meta()`.
		$schema = $this->add_meta_fields_schema( $schema );

		// Allow the schema to be filtered.
		$schema = $this->filter_item_schema( $schema );

		/**
		 * Set `$this->schema` here so that we can exclude additional fields
		 * already covered by the base, filtered, schema.
		 *
		 * Additional fields are added through the call to add_additional_fields_schema() below,


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0-beta.3 Return early with a WP_Error if $object is a WP_Error.
1.0.0-beta.14 Pass the $request parameter to prepare_links().
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.