LLMS_REST_Enrollments_Controller::prepare_items_query( array $prepared_args = array(), WP_REST_Request $request = null )
Determines the allowed query_vars for a get_items() response and prepares them for WP_Query.
Parameters Parameters
- $prepared_args
-
(array) (Optional) Prepared WP_Query arguments.
Default value: array()
- $request
-
(WP_REST_Request) (Optional) Full details about the request.
Default value: null
Return Return
(array) Items query arguments.
Source Source
File: libraries/lifterlms-rest/includes/server/class-llms-rest-enrollments-controller.php
$prepared = parent::prepare_collection_query_args( $request ); if ( is_wp_error( $prepared ) ) { return $prepared; } $prepared['id'] = $request['id']; $prepared['page'] = ! isset( $prepared['page'] ) ? 1 : $prepared['page']; return $this->prepare_items_query( $prepared, $request ); } /** * Determines the allowed query_vars for a get_items() response and prepares * them for WP_Query. * * @since 1.0.0-beta.1 * * @param array $prepared_args Optional. Prepared WP_Query arguments. Default empty array. * @param WP_REST_Request $request Optional. Full details about the request. * @return array Items query arguments. */ protected function prepare_items_query( $prepared_args = array(), $request = null ) { $query_args = array(); foreach ( $prepared_args as $key => $value ) { $query_args[ $key ] = $value; } // Filters. if ( isset( $query_args['student'] ) && ! is_array( $query_args['student'] ) ) { $query_args['student'] = array_map( 'absint', explode( ',', $query_args['student'] ) ); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
1.0.0-beta.1 | Introduced. |