Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::prepare_items()publicWC 1.0

Prepares reviews for display.

{} Это метод класса: ReviewsListTable{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$ReviewsListTable = new ReviewsListTable();
$ReviewsListTable->prepare_items() : void;

Код ReviewsListTable::prepare_items() WC 6.8.0

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 );

	$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(),
		]
	);
}