WC_Admin_Post_Types::setup_screen()
Looks at the current screen and loads the correct list table handler.
Description Description
Source Source
File: includes/admin/class-wc-admin-post-types.php
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | public function setup_screen() { global $wc_list_table ; $screen_id = false; if ( function_exists( 'get_current_screen' ) ) { $screen = get_current_screen(); $screen_id = isset( $screen , $screen ->id ) ? $screen ->id : '' ; } if ( ! empty ( $_REQUEST [ 'screen' ] ) ) { // WPCS: input var ok. $screen_id = wc_clean( wp_unslash( $_REQUEST [ 'screen' ] ) ); // WPCS: input var ok, sanitization ok. } switch ( $screen_id ) { case 'edit-shop_order' : include_once 'list-tables/class-wc-admin-list-table-orders.php' ; $wc_list_table = new WC_Admin_List_Table_Orders(); break ; case 'edit-shop_coupon' : include_once 'list-tables/class-wc-admin-list-table-coupons.php' ; $wc_list_table = new WC_Admin_List_Table_Coupons(); break ; case 'edit-product' : include_once 'list-tables/class-wc-admin-list-table-products.php' ; $wc_list_table = new WC_Admin_List_Table_Products(); break ; } // Ensure the table handler is only loaded once. Prevents multiple loads if a plugin calls check_ajax_referer many times. remove_action( 'current_screen' , array ( $this , 'setup_screen' ) ); remove_action( 'check_ajax_referer' , array ( $this , 'setup_screen' ) ); } |
Changelog Changelog
Version | Description |
---|---|
3.3.0 | Introduced. |