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.

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

Хуки из метода

Возвращает

Строку. Empty string if there are no pending reviews, or bubble HTML if there are.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_pending_count_bubble() : string;

Код Reviews::get_pending_count_bubble() WC 8.7.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>';
}