BP_REST_Document_Folder_Endpoint:: get_item (WP_REST_Request美元的请求

文件夹检索文档。

描述

参数

美元的请求

WP_REST_Request(必需)请求的全部细节。

返回

(WP_REST_Response)| WP_Error

文件:bp-document /类/ class-bp-rest-document-folder-endpoint.php

Public function get_items($request) {$args = array('page' => $request['page'], 'per_page' => $request['per_page'], 'sort' => strtoupper($request['order']), 'order_by' => $request['orderby'], 'count_total' => $request['count_total'],);如果(!$args['search_terms'] = $request['search']; / /搜索结果} if (!空($请求[马克斯 '] ) ) { $ args(“max”)= $请求(“max”);} if (!空($ [' user_id请求 '] ) ) { $ args(“user_id”)= $请求(“user_id”);}如果(收取($请求(“母公司”))& &空! = = $请求(“母公司”)){$ args(“母公司”)= $请求(“母公司”);} if (!空($ [' group_id请求 '] ) ) { $ args(“group_id”)= $请求(“group_id”); } if ( ! empty( $request['privacy'] ) ) { $args['privacy'] = $request['privacy']; } if ( ! empty( $request['exclude'] ) ) { $args['exclude'] = $request['exclude']; } if ( ! empty( $request['include'] ) ) { $args['in'] = $request['include']; } /** * Filter the query arguments for the request. * * @param array $args Key value array of query var to query value. * @param WP_REST_Request $request The request sent to the API. * * @since 0.1.0 */ $args = apply_filters( 'bp_rest_document_folder_get_items_query_args', $args, $request ); $folders = $this->assemble_response_data( $args ); $retval = array(); foreach ( $folders['folders'] as $folder ) { $retval[] = $this->prepare_response_for_collection( $this->document_endpoint->prepare_item_for_response( $folder, $request ) ); } $response = rest_ensure_response( $retval ); $response = bp_rest_response_add_total_headers( $response, $folders['total'], $args['per_page'] ); /** * Fires after a list of document's folder is fetched via the REST API. * * @since 0.1.0 * * @param WP_REST_Response $response The response data. * @param WP_REST_Request $request The request sent to the API. * * @param array $folders Fetched Folders. */ do_action( 'bp_rest_document_folder_get_items', $folders, $response, $request ); return $response; }

更新日志

更新日志
版本 描述
0.1.0 介绍了。

问题吗?

我们总是很乐意帮助您解决代码或其他问题!搜索我们的开发人员文档联络支持,或与我们联系销售团队