Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::prepare_items
Prepares reviews for display.
Method of the class: ReviewsListTable{}
Hooks from the method
Returns
null. Nothing (null).
Usage
$ReviewsListTable = new ReviewsListTable(); $ReviewsListTable->prepare_items() : void;
ReviewsListTable::prepare_items() ReviewsListTable::prepare items code WC 10.3.6
public function prepare_items() : void {
$this->set_review_status();
$this->set_review_type();
$this->current_reviews_rating = isset( $_REQUEST['review_rating'] ) ? absint( $_REQUEST['review_rating'] ) : 0;
$this->set_review_product();
$args = [
'number' => $this->get_per_page(),
'post_type' => 'product',
];
// Include the order & orderby arguments.
$args = wp_parse_args( $this->get_sort_arguments(), $args );
// Handle the review item types filter.
$args = wp_parse_args( $this->get_filter_type_arguments(), $args );
// Handle the reviews rating filter.
$args = wp_parse_args( $this->get_filter_rating_arguments(), $args );
// Handle the review product filter.
$args = wp_parse_args( $this->get_filter_product_arguments(), $args );
// Include the review status arguments.
$args = wp_parse_args( $this->get_status_arguments(), $args );
// Include the search argument.
$args = wp_parse_args( $this->get_search_arguments(), $args );
// Include the offset argument.
$args = wp_parse_args( $this->get_offset_arguments(), $args );
/**
* Provides an opportunity to alter the comment query arguments used within
* the product reviews admin list table.
*
* @since 7.0.0
*
* @param array $args Comment query args.
*/
$args = (array) apply_filters( 'woocommerce_product_reviews_list_table_prepare_items_args', $args );
$comments = get_comments( $args );
update_comment_cache( $comments );
$this->items = $comments;
$this->set_pagination_args(
[
'total_items' => get_comments( $this->get_total_comments_arguments( $args ) ),
'per_page' => $this->get_per_page(),
]
);
}