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rc.2 3.1.0 6.2.1 3.1.1 6.2.2 3.1.2 6.2.3 3.2.0 6.3.0 3.2.1 6.3.0-beta.1 3.2.2 6.3.0-rc.1 3.2.3 6.3.0-rc.2 3.2.4 6.3.1 3.2.5 6.3.2 3.2.6 6.4.0 3.3.0 6.4.0-beta.1 3.3.1 6.4.0-rc.1 3.3.2 6.4.1 3.3.2-rc.1 6.4.2 3.3.3 6.5.0 3.3.4 6.5.0-beta.1 3.3.5 6.5.0-rc.1 3.3.6 6.5.0-rc.2 3.4.0 6.5.1 3.4.0-beta.1 6.5.2 3.4.0-rc.2 6.6.0 3.4.1 6.6.0-beta.1 3.4.2 6.6.0-rc.1 3.4.3 6.6.0-rc.2 3.4.4 6.6.1 3.4.5 6.6.2 3.4.6 6.7.0 3.4.7 6.7.0-beta.1 3.4.8 6.7.0-beta.2 3.5.0 6.7.0-rc.1 3.5.0-beta.1 6.7.1 3.5.0-rc.1 6.8.0 3.5.0-rc.2 6.8.0-beta.1 3.5.1 6.8.0-beta.2 3.5.10 6.8.0-rc.1 3.5.2 6.8.1 3.5.3 6.8.2 3.5.4 6.8.3 3.5.5 6.9.0 3.5.6 6.9.0-beta.1 3.5.7 6.9.0-beta.2 3.5.8 6.9.0-rc.1 3.5.9 6.9.1 3.6.0 6.9.2 3.6.0-beta.1 6.9.3 3.6.0-rc.1 6.9.4 3.6.0-rc.2 6.9.5 3.6.0-rc.3 7.0.0 3.6.1 7.0.0-beta.1 3.6.2 7.0.0-beta.2 3.6.3 7.0.0-beta.3 3.6.4 7.0.0-rc.1 3.6.5 7.0.0-rc.2 3.6.6 7.0.1 3.6.7 7.0.2 3.7.0 7.1.0 3.7.0-beta.1 7.1.0-beta.1 3.7.0-rc.1 7.1.0-beta.2 3.7.0-rc.2 7.1.0-rc.1 3.7.1 7.1.0-rc.2 3.7.2 7.1.1
woocommerce / includes / admin / list-tables / abstract-class-wc-admin-list-table.php
woocommerce / includes / admin / list-tables Last commit date
abstract-class-wc-admin-list-table.php 5 years ago class-wc-admin-list-table-coupons.php 2 years ago class-wc-admin-list-table-orders.php 5 months ago class-wc-admin-list-table-products.php 1 month ago
abstract-class-wc-admin-list-table.php
277 lines
1 <?php
2 /**
3 * List tables.
4 *
5 * @package WooCommerce\Admin
6 * @version 3.3.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( class_exists( 'WC_Admin_List_Table', false ) ) {
14 return;
15 }
16
17 /**
18 * WC_Admin_List_Table Class.
19 */
20 abstract class WC_Admin_List_Table {
21
22 /**
23 * Post type.
24 *
25 * @var string
26 */
27 protected $list_table_type = '';
28
29 /**
30 * Object being shown on the row.
31 *
32 * @var object|null
33 */
34 protected $object = null;
35
36 /**
37 * Constructor.
38 */
39 public function __construct() {
40 if ( $this->list_table_type ) {
41 add_action( 'manage_posts_extra_tablenav', array( $this, 'maybe_render_blank_state' ) );
42 add_filter( 'view_mode_post_types', array( $this, 'disable_view_mode' ) );
43 add_action( 'restrict_manage_posts', array( $this, 'restrict_manage_posts' ) );
44 add_filter( 'request', array( $this, 'request_query' ) );
45 add_filter( 'post_row_actions', array( $this, 'row_actions' ), 100, 2 );
46 add_filter( 'default_hidden_columns', array( $this, 'default_hidden_columns' ), 10, 2 );
47 add_filter( 'list_table_primary_column', array( $this, 'list_table_primary_column' ), 10, 2 );
48 add_filter( 'manage_edit-' . $this->list_table_type . '_sortable_columns', array( $this, 'define_sortable_columns' ) );
49 add_filter( 'manage_' . $this->list_table_type . '_posts_columns', array( $this, 'define_columns' ) );
50 add_filter( 'bulk_actions-edit-' . $this->list_table_type, array( $this, 'define_bulk_actions' ) );
51 add_action( 'manage_' . $this->list_table_type . '_posts_custom_column', array( $this, 'render_columns' ), 10, 2 );
52 add_filter( 'handle_bulk_actions-edit-' . $this->list_table_type, array( $this, 'handle_bulk_actions' ), 10, 3 );
53 }
54 }
55
56 /**
57 * Show blank slate.
58 *
59 * @param string $which String which tablenav is being shown.
60 */
61 public function maybe_render_blank_state( $which ) {
62 global $post_type;
63
64 if ( $post_type === $this->list_table_type && 'bottom' === $which ) {
65 $counts = (array) wp_count_posts( $post_type );
66 unset( $counts['auto-draft'] );
67 $count = array_sum( $counts );
68
69 if ( 0 < $count ) {
70 return;
71 }
72
73 $this->render_blank_state();
74
75 echo '<style type="text/css">#posts-filter .wp-list-table, #posts-filter .tablenav.top, .tablenav.bottom .actions, .wrap .subsubsub { display: none; } #posts-filter .tablenav.bottom { height: auto; } </style>';
76 }
77 }
78
79 /**
80 * Render blank state. Extend to add content.
81 */
82 protected function render_blank_state() {}
83
84 /**
85 * Removes this type from list of post types that support "View Mode" switching.
86 * View mode is seen on posts where you can switch between list or excerpt. Our post types don't support
87 * it, so we want to hide the useless UI from the screen options tab.
88 *
89 * @param array $post_types Array of post types supporting view mode.
90 * @return array Array of post types supporting view mode, without this type.
91 */
92 public function disable_view_mode( $post_types ) {
93 unset( $post_types[ $this->list_table_type ] );
94 return $post_types;
95 }
96
97 /**
98 * See if we should render search filters or not.
99 */
100 public function restrict_manage_posts() {
101 global $typenow;
102
103 if ( $this->list_table_type === $typenow ) {
104 $this->render_filters();
105 }
106 }
107
108 /**
109 * Handle any filters.
110 *
111 * @param array $query_vars Query vars.
112 * @return array
113 */
114 public function request_query( $query_vars ) {
115 global $typenow;
116
117 if ( $this->list_table_type === $typenow ) {
118 return $this->query_filters( $query_vars );
119 }
120
121 return $query_vars;
122 }
123
124 /**
125 * Render any custom filters and search inputs for the list table.
126 */
127 protected function render_filters() {}
128
129 /**
130 * Handle any custom filters.
131 *
132 * @param array $query_vars Query vars.
133 * @return array
134 */
135 protected function query_filters( $query_vars ) {
136 return $query_vars;
137 }
138
139 /**
140 * Set row actions.
141 *
142 * @param array $actions Array of actions.
143 * @param WP_Post $post Current post object.
144 * @return array
145 */
146 public function row_actions( $actions, $post ) {
147 if ( $this->list_table_type === $post->post_type ) {
148 return $this->get_row_actions( $actions, $post );
149 }
150 return $actions;
151 }
152
153 /**
154 * Get row actions to show in the list table.
155 *
156 * @param array $actions Array of actions.
157 * @param WP_Post $post Current post object.
158 * @return array
159 */
160 protected function get_row_actions( $actions, $post ) {
161 return $actions;
162 }
163
164 /**
165 * Adjust which columns are displayed by default.
166 *
167 * @param array $hidden Current hidden columns.
168 * @param object $screen Current screen.
169 * @return array
170 */
171 public function default_hidden_columns( $hidden, $screen ) {
172 if ( isset( $screen->id ) && 'edit-' . $this->list_table_type === $screen->id ) {
173 $hidden = array_merge( $hidden, $this->define_hidden_columns() );
174 }
175 return $hidden;
176 }
177
178 /**
179 * Set list table primary column.
180 *
181 * @param string $default Default value.
182 * @param string $screen_id Current screen ID.
183 * @return string
184 */
185 public function list_table_primary_column( $default, $screen_id ) {
186 if ( 'edit-' . $this->list_table_type === $screen_id && $this->get_primary_column() ) {
187 return $this->get_primary_column();
188 }
189 return $default;
190 }
191
192 /**
193 * Define primary column.
194 *
195 * @return array
196 */
197 protected function get_primary_column() {
198 return '';
199 }
200
201 /**
202 * Define hidden columns.
203 *
204 * @return array
205 */
206 protected function define_hidden_columns() {
207 return array();
208 }
209
210 /**
211 * Define which columns are sortable.
212 *
213 * @param array $columns Existing columns.
214 * @return array
215 */
216 public function define_sortable_columns( $columns ) {
217 return $columns;
218 }
219
220 /**
221 * Define which columns to show on this screen.
222 *
223 * @param array $columns Existing columns.
224 * @return array
225 */
226 public function define_columns( $columns ) {
227 return $columns;
228 }
229
230 /**
231 * Define bulk actions.
232 *
233 * @param array $actions Existing actions.
234 * @return array
235 */
236 public function define_bulk_actions( $actions ) {
237 return $actions;
238 }
239
240 /**
241 * Pre-fetch any data for the row each column has access to it.
242 *
243 * @param int $post_id Post ID being shown.
244 */
245 protected function prepare_row_data( $post_id ) {}
246
247 /**
248 * Render individual columns.
249 *
250 * @param string $column Column ID to render.
251 * @param int $post_id Post ID being shown.
252 */
253 public function render_columns( $column, $post_id ) {
254 $this->prepare_row_data( $post_id );
255
256 if ( ! $this->object ) {
257 return;
258 }
259
260 if ( is_callable( array( $this, 'render_' . $column . '_column' ) ) ) {
261 $this->{"render_{$column}_column"}();
262 }
263 }
264
265 /**
266 * Handle bulk actions.
267 *
268 * @param string $redirect_to URL to redirect to.
269 * @param string $action Action name.
270 * @param array $ids List of ids.
271 * @return string
272 */
273 public function handle_bulk_actions( $redirect_to, $action, $ids ) {
274 return esc_url_raw( $redirect_to );
275 }
276 }
277