Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::prepare_itemspublicWC 1.0

Prepares reviews for display.

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

Возвращает

null. Ничего (null).

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

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

Код ReviewsListTable::prepare_items() WC 10.7.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',
		'update_comment_post_cache' => true,
	];

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

	/** @var \WP_Comment[] $comments */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort
	$comments    = get_comments( $args );
	$this->items = $comments;

	$this->set_pagination_args(
		[
			'total_items' => get_comments( $this->get_total_comments_arguments( $args ) ),
			'per_page'    => $this->get_per_page(),
		]
	);
}