Automattic\WooCommerce\Internal\Admin\Orders
ListTable::get_view_link()
Form a link to use in the list of table views.
Method of the class: ListTable{}
No Hooks.
Return
String
.
Usage
// private - for code of main (parent) class only $result = $this->get_view_link( $slug, $name, $count, $current ): string;
- $slug(string) (required)
- Slug used to identify the view (usually the order status slug).
- $name(string) (required)
- Human-readable name of the view (usually the order status label).
- $count(int) (required)
- Number of items in this view.
- $current(true|false) (required)
- If this is the current view.
ListTable::get_view_link() ListTable::get view link code WC 9.6.1
private function get_view_link( string $slug, string $name, int $count, bool $current ): string { $base_url = get_admin_url( null, 'admin.php?page=wc-orders' . ( 'shop_order' === $this->order_type ? '' : '--' . $this->order_type ) ); $url = esc_url( add_query_arg( 'status', $slug, $base_url ) ); $name = esc_html( $name ); $count = number_format_i18n( $count ); $class = $current ? 'class="current"' : ''; return "<a href='$url' $class>$name <span class='count'>($count)</span></a>"; }