LLMS_REST_Enrollments_Controller::prepare_object_for_response( stdClass $enrollment, WP_REST_Request $request )

Prepare a single object output for response.

Parameters Parameters


(stdClass) (Required) Enrollment object.


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

Top ↑

Return Return


Top ↑

Source Source

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

	public function prepare_object_for_response( $enrollment, $request ) {

		$prepared_enrollment = get_object_vars( $enrollment );

		// Apply filters.
		$prepared_enrollment['status'] = apply_filters(

		// Filter data including only schema props.
		$data = array_intersect_key( $prepared_enrollment, array_flip( $this->get_fields_for_response( $request ) ) );

		 * Filters the enrollment data for a response.
		 * @since 1.0.0-beta.10
		 * @param array           $data       Array of enrollment properties prepared for response.
		 * @param stdClass        $enrollment Enrollment object.
		 * @param WP_REST_Request $request    Full details about the request.
		return apply_filters( 'llms_rest_prepare_enrollment_object_response', $data, $enrollment, $request );

Top ↑

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.

Top ↑

User Contributed Notes User Contributed Notes

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