Automattic\WooCommerce\Internal\Admin\Orders

ListTable::get_views()publicWC 1.0

Get the list of views for this table (all orders, completed orders, etc, each with a count of the number of corresponding orders).

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

Хуков нет.

Возвращает

Массив.

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

$ListTable = new ListTable();
$ListTable->get_views();

Код ListTable::get_views() WC 7.5.1

public function get_views() {
	$view_counts = array();
	$view_links  = array();
	$statuses    = $this->get_visible_statuses();
	$current     = ! empty( $this->request['status'] ) ? sanitize_text_field( $this->request['status'] ) : 'all';
	$all_count   = 0;

	foreach ( array_keys( $statuses ) as $slug ) {
		$total_in_status = $this->count_orders_by_status( $slug );

		if ( $total_in_status > 0 ) {
			$view_counts[ $slug ] = $total_in_status;
		}

		if ( ( get_post_status_object( $slug ) )->show_in_admin_all_list ) {
			$all_count += $total_in_status;
		}
	}

	$view_links['all'] = $this->get_view_link( 'all', __( 'All', 'woocommerce' ), $all_count, '' === $current || 'all' === $current );

	foreach ( $view_counts as $slug => $count ) {
		$view_links[ $slug ] = $this->get_view_link( $slug, $statuses[ $slug ], $count, $slug === $current );
	}

	return $view_links;
}