WC_Admin_Webhooks_Table_List::get_views()
Table list views.
Method of the class: WC_Admin_Webhooks_Table_List{}
No Hooks.
Return
Array
.
Usage
// protected - for code of main (parent) or child class $result = $this->get_views();
WC_Admin_Webhooks_Table_List::get_views() WC Admin Webhooks Table List::get views code WC 7.5.1
protected function get_views() { $status_links = array(); $data_store = WC_Data_Store::load( 'webhook' ); $num_webhooks = $data_store->get_count_webhooks_by_status(); $total_webhooks = array_sum( (array) $num_webhooks ); $statuses = array_keys( wc_get_webhook_statuses() ); $class = empty( $_REQUEST['status'] ) ? ' class="current"' : ''; // WPCS: input var okay. CSRF ok. /* translators: %s: count */ $status_links['all'] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_webhooks, 'posts', 'woocommerce' ), number_format_i18n( $total_webhooks ) ) . '</a>'; foreach ( $statuses as $status_name ) { $class = ''; if ( empty( $num_webhooks[ $status_name ] ) ) { continue; } if ( isset( $_REQUEST['status'] ) && sanitize_key( wp_unslash( $_REQUEST['status'] ) ) === $status_name ) { // WPCS: input var okay, CSRF ok. $class = ' class="current"'; } $label = $this->get_status_label( $status_name, $num_webhooks[ $status_name ] ); $status_links[ $status_name ] = "<a href='admin.php?page=wc-settings&tab=advanced&section=webhooks&status=$status_name'$class>" . sprintf( translate_nooped_plural( $label, $num_webhooks[ $status_name ] ), number_format_i18n( $num_webhooks[ $status_name ] ) ) . '</a>'; } return $status_links; }