Automattic\WooCommerce\Internal\Admin\ProductReviews

ReviewsListTable::get_view_url()protectedWC 1.0

Gets the base URL for a view, excluding the status (that should be appended).

Method of the class: ReviewsListTable{}

No Hooks.

Return

String.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_view_url( $comment_type, $post_id ) : string;
$comment_type(string) (required)
Comment type filter.
$post_id(int) (required)
Current post ID.

ReviewsListTable::get_view_url() code WC 9.4.2

protected function get_view_url( string $comment_type, int $post_id ) : string {
	$link = Reviews::get_reviews_page_url();

	if ( ! empty( $comment_type ) && 'all' !== $comment_type ) {
		$link = add_query_arg( 'comment_type', urlencode( $comment_type ), $link );
	}
	if ( ! empty( $post_id ) ) {
		$link = add_query_arg( 'p', absint( $post_id ), $link );
	}

	return $link;
}