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.
Return Return
(WP_Error|WP_REST_Response)
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,
Expand full source code Collapse full source code View on GitHub
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. |