Automattic\WooCommerce\Internal\Admin\ProductReviews
ReviewsListTable::get_views()
Returns the available status filters.
Method of the class: ReviewsListTable{}
No Hooks.
Return
Array
. An associative array of fully-formed comment status links. Includes 'All', 'Pending', 'Approved', 'Spam', and 'Trash'.
Usage
// protected - for code of main (parent) or child class $result = $this->get_views() : array;
Notes
- See: WP_Comments_List_Table::get_views() for consistency.
- Global. Int. $post_id
- Global. String. $comment_status
- Global. String. $comment_type
ReviewsListTable::get_views() ReviewsListTable::get views code WC 9.4.2
protected function get_views() : array { global $post_id, $comment_status, $comment_type; $status_links = []; $status_labels = $this->get_status_filters(); if ( ! EMPTY_TRASH_DAYS ) { unset( $status_labels['trash'] ); } $link = $this->get_view_url( (string) $comment_type, (int) $post_id ); foreach ( $status_labels as $status => $label ) { $current_link_attributes = ''; if ( $status === $comment_status ) { $current_link_attributes = ' class="current" aria-current="page"'; } $link = add_query_arg( 'comment_status', urlencode( $status ), $link ); $number_reviews_for_status = $this->get_review_count( $status, (int) $post_id ); $count_html = sprintf( '<span class="%s-count">%s</span>', ( 'moderated' === $status ) ? 'pending' : $status, number_format_i18n( $number_reviews_for_status ) ); $status_links[ $status ] = '<a href="' . esc_url( $link ) . '"' . $current_link_attributes . '>' . sprintf( translate_nooped_plural( $label, $number_reviews_for_status ), $count_html ) . '</a>'; } return $status_links; }