LLMS_REST_Enrollments_Controller::prepare_object_for_response( stdClass $enrollment, WP_REST_Request $request )
Prepare a single object output for response.
Parameters Parameters
- $enrollment
-
(stdClass) (Required) Enrollment object.
- $request
-
(WP_REST_Request) (Required) Full details about the request.
Return Return
(array)
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php
$query->items[ $key ]->student_id = (int) $item->student_id; $query->items[ $key ]->trigger = (string) $item->etrigger; unset( $query->items[ $key ]->etrigger ); } } $query->found_results = empty( $query_args['no_found_rows'] ) ? absint( $wpdb->get_var( 'SELECT FOUND_ROWS()' ) ) : $count; // no-cache ok. return $query; } /** * Prepare a single object output for response. * * @since 1.0.0-beta.1 * @since 1.0.0-beta.10 Filter enrollment to include only fields available for response. * Added `llms_rest_prepare_enrollment_object_response` filter hook. * * @param stdClass $enrollment Enrollment object. * @param WP_REST_Request $request Full details about the request. * @return array */ public function prepare_object_for_response( $enrollment, $request ) { $prepared_enrollment = get_object_vars( $enrollment );
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.10 | Filter enrollment to include only fields available for response. Added llms_rest_prepare_enrollment_object_response filter hook. |
1.0.0-beta.1 | Introduced. |