Automattic\WooCommerce\Internal\Admin\ProductReviews

Reviews::get_pending_count_bubble()protectedWC 1.0

Counts the number of pending product reviews/replies, and returns the notification bubble if there's more than zero.

Method of the class: Reviews{}

Return

String. Empty string if there are no pending reviews, or bubble HTML if there are.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_pending_count_bubble() : string;

Reviews::get_pending_count_bubble() code WC 7.1.0

protected function get_pending_count_bubble() : string {
	$count = (int) get_comments(
		[
			'type__in'  => [ 'review', 'comment' ],
			'status'    => '0',
			'post_type' => 'product',
			'count'     => true,
		]
	);

	/**
	 * Provides an opportunity to alter the pending comment count used within
	 * the product reviews admin list table.
	 *
	 * @since 7.0.0
	 *
	 * @param array $count Current count of comments pending review.
	 */
	$count = apply_filters( 'woocommerce_product_reviews_pending_count', $count );

	if ( empty( $count ) ) {
		return '';
	}

	return ' <span class="awaiting-mod count-' . esc_attr( $count ) . '"><span class="pending-count">' . esc_html( $count ) . '</span></span>';
}