LLMS_REST_Controller_Stubs::prepare_object_for_response( LLMS_Abstract_User_Data $object, WP_REST_Request $request )
Prepare an object for response.
Parameters Parameters
- $object
-
(LLMS_Abstract_User_Data) (Required) User object.
- $request
-
(WP_REST_Request) (Required) Request object.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/abstracts/class-llms-rest-controller-stubs.php
$data = $this->prepare_object_for_response( $object, $request ); $response_fields = $this->get_fields_for_response( $request ); // Include meta data registered via `register_meta()`. if ( rest_is_field_included( 'meta', $response_fields ) ) { $data['meta'] = $this->meta->get_value( $this->get_object_id( $object ), $request ); // Exclude disallowed meta. $data['meta'] = $this->exclude_disallowed_meta_fields( $data['meta'] ); } // Include custom REST fields registered via `register_rest_field()`. $data = $this->add_additional_fields_to_object( $data, $request ); $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; $data = $this->filter_response_by_context( $data, $context ); return $data; }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.3 | Conditionally throw _doing_it_wrong() . |
1.0.0-beta.1 | Introduced. |