Automattic\WooCommerce\Admin\API
Notes::prepare_objects_query()
Prepare objects query.
Метод класса: Notes{}
Хуки из метода
Возвращает
Массив
.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->prepare_objects_query( $request );
- $request(WP_REST_Request) (обязательный)
- Full details about the request.
Код Notes::prepare_objects_query() Notes::prepare objects query WC 9.2.3
protected function prepare_objects_query( $request ) { $args = array(); $args['order'] = $request['order']; $args['orderby'] = $request['orderby']; $args['per_page'] = $request['per_page']; $args['page'] = $request['page']; $args['type'] = isset( $request['type'] ) ? $request['type'] : array(); $args['status'] = isset( $request['status'] ) ? $request['status'] : array(); $args['source'] = isset( $request['source'] ) ? $request['source'] : array(); $args['is_deleted'] = 0; if ( isset( $request['is_read'] ) ) { $args['is_read'] = filter_var( $request['is_read'], FILTER_VALIDATE_BOOLEAN ); } if ( 'date' === $args['orderby'] ) { $args['orderby'] = 'date_created'; } /** * Filter the query arguments for a request. * * Enables adding extra arguments or setting defaults for a post * collection request. * * @param array $args Key value array of query var to query value. * @param WP_REST_Request $request The request used. * @since 3.9.0 */ $args = apply_filters( 'woocommerce_rest_notes_object_query', $args, $request ); return $args; }