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.2.0 10.0.1 5.2.0-beta.1 10.0.2 5.2.0-rc.1 10.0.3 5.2.0-rc.2 10.0.4 5.2.1 10.0.5 5.2.2 10.0.6 5.2.3 10.1.0 5.2.4 10.1.0-rc.1 5.2.5 10.1.0-rc.2 5.3.0 10.1.0-rc.3 5.3.0-beta.1 10.1.0-rc.4 5.3.0-rc.1 10.1.1 5.3.0-rc.2 10.1.2 5.3.1 10.1.3 5.3.2 10.1.4 5.3.3 10.2.0 5.4.0 10.2.0-beta.1 5.4.0-beta.1 10.2.0-beta.2 5.4.0-rc.1 10.2.0-rc.1 5.4.1 10.2.1 5.4.2 10.2.2 5.4.3 10.2.3 5.4.4 10.2.4 5.4.5 10.3.0 5.5.0 10.3.0-beta.1 5.5.0-beta.1 10.3.0-beta.2 5.5.0-rc.1 10.3.0-rc.1 5.5.0-rc.2 10.3.0-rc.2 5.5.1 10.3.1 5.5.2 10.3.2 5.5.3 10.3.3 5.5.4 10.3.4 5.5.5 10.3.5 5.6.0 10.3.6 5.6.0-beta.1 10.3.7 5.6.0-rc.1 10.3.8 5.6.0-rc.2 10.4.0 5.6.1 10.4.0-beta.1 5.6.2 10.4.0-beta.2 5.6.3 10.4.0-rc.1 5.7.0 10.4.1 5.7.0-beta.1 10.4.2 5.7.0-rc.1 10.4.3 5.7.1 10.4.4 5.7.2 10.5.0 5.7.3 10.5.0-beta.1 5.8.0 10.5.0-beta.2 5.8.0-beta.1 10.5.0-rc.1 5.8.0-beta.2 10.5.0-rc.2 5.8.0-rc.1 10.5.0-rc.3 5.8.1 10.5.1 5.8.2 10.5.2 5.9.0 10.5.3 5.9.0-beta.1 10.6.0 5.9.0-rc.1 10.6.0-beta.1 5.9.0-rc.2 10.6.0-beta.2 5.9.1 10.6.0-rc.1 5.9.2 10.6.1 6.0.0 10.6.2 6.0.0-beta.1 10.7.0 6.0.0-rc.1 10.7.0-beta.1 6.0.1 10.7.0-beta.2 6.0.2 10.7.0-rc.1 6.1.0 3.0.0 6.1.0-beta.1 3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.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 / react-admin / connect-existing-pages.php
woocommerce / includes / react-admin Last commit date
emails 1 year ago class-experimental-abtest.php 1 year ago connect-existing-pages.php 2 weeks ago core-functions.php 3 years ago feature-config.php 1 week ago page-controller-functions.php 4 years ago wc-admin-update-functions.php 6 months ago
connect-existing-pages.php
320 lines
1 <?php
2 /**
3 * Connect existing WooCommerce pages to WooCommerce Admin.
4 *
5 * @package WooCommerce\Admin
6 */
7
8 use Automattic\WooCommerce\Admin\PageController;
9 use Automattic\WooCommerce\Utilities\OrderUtil;
10
11 /**
12 * Returns core WC pages to connect to WC-Admin.
13 *
14 * @return array
15 */
16 function wc_admin_get_core_pages_to_connect() {
17 $all_reports = WC_Admin_Reports::get_reports();
18 $report_tabs = array();
19
20 foreach ( $all_reports as $report_id => $report_data ) {
21 $report_tabs[ $report_id ] = $report_data['title'];
22 }
23
24 return array(
25 'wc-addons' => array(
26 'title' => __( 'Extensions', 'woocommerce' ),
27 'tabs' => array(),
28 ),
29 'wc-reports' => array(
30 'title' => __( 'Reports', 'woocommerce' ),
31 'tabs' => $report_tabs,
32 ),
33 'wc-settings' => array(
34 'title' => __( 'Settings', 'woocommerce' ),
35 'tabs' => apply_filters( 'woocommerce_settings_tabs_array', array() ), // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
36 ),
37 'wc-status' => array(
38 'title' => __( 'Status', 'woocommerce' ),
39 // phpcs:ignore WooCommerce.Commenting.CommentHooks.MissingHookComment
40 'tabs' => apply_filters(
41 'woocommerce_admin_status_tabs',
42 array(
43 'status' => __( 'System status', 'woocommerce' ),
44 'tools' => __( 'Tools', 'woocommerce' ),
45 'logs' => __( 'Logs', 'woocommerce' ),
46 )
47 ),
48 ),
49 );
50 }
51
52 /**
53 * Filter breadcrumbs for core pages that aren't explicitly connected.
54 *
55 * @param array $breadcrumbs Breadcrumb pieces.
56 * @return array Filtered breadcrumb pieces.
57 */
58 function wc_admin_filter_core_page_breadcrumbs( $breadcrumbs ) {
59 $screen_id = PageController::get_instance()->get_current_screen_id();
60 $pages_to_connect = wc_admin_get_core_pages_to_connect();
61 $woocommerce_breadcrumb = array(
62 'admin.php?page=wc-admin',
63 __( 'WooCommerce', 'woocommerce' ),
64 );
65
66 foreach ( $pages_to_connect as $page_id => $page_data ) {
67 if ( preg_match( "/^woocommerce_page_{$page_id}\-/", $screen_id ) ) {
68 if ( empty( $page_data['tabs'] ) ) {
69 $new_breadcrumbs = array(
70 $woocommerce_breadcrumb,
71 $page_data['title'],
72 );
73 } else {
74 $new_breadcrumbs = array(
75 $woocommerce_breadcrumb,
76 array(
77 add_query_arg( 'page', $page_id, 'admin.php' ),
78 $page_data['title'],
79 ),
80 );
81
82 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
83 if ( isset( $_GET['tab'] ) ) {
84 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
85 $current_tab = wc_clean( wp_unslash( $_GET['tab'] ) );
86 } else {
87 $current_tab = key( $page_data['tabs'] );
88 }
89
90 $new_breadcrumbs[] = $page_data['tabs'][ $current_tab ];
91 }
92
93 return $new_breadcrumbs;
94 }
95 }
96
97 return $breadcrumbs;
98 }
99
100 /**
101 * Render the WC-Admin header bar on all WooCommerce core pages.
102 *
103 * @param bool $is_connected Whether the current page is connected.
104 * @param bool $current_page The current page, if connected.
105 * @return bool Whether to connect the page.
106 */
107 function wc_admin_connect_core_pages( $is_connected, $current_page ) {
108 if ( false === $is_connected && false === $current_page ) {
109 $screen_id = PageController::get_instance()->get_current_screen_id();
110 $pages_to_connect = wc_admin_get_core_pages_to_connect();
111
112 foreach ( $pages_to_connect as $page_id => $page_data ) {
113 if ( preg_match( "/^woocommerce_page_{$page_id}\-/", $screen_id ) ) {
114 add_filter( 'woocommerce_navigation_get_breadcrumbs', 'wc_admin_filter_core_page_breadcrumbs' );
115
116 return true;
117 }
118 }
119 }
120
121 return $is_connected;
122 }
123
124 add_filter( 'woocommerce_navigation_is_connected_page', 'wc_admin_connect_core_pages', 10, 2 );
125
126 $posttype_list_base = 'edit.php';
127
128 // WooCommerce > Orders.
129 wc_admin_connect_page(
130 array(
131 'id' => 'woocommerce-orders',
132 'screen_id' => 'edit-shop_order',
133 'title' => __( 'Orders', 'woocommerce' ),
134 'path' => add_query_arg( 'post_type', 'shop_order', $posttype_list_base ),
135 )
136 );
137
138 // WooCommerce > Orders > Add New.
139 wc_admin_connect_page(
140 array(
141 'id' => 'woocommerce-add-order',
142 'parent' => 'woocommerce-orders',
143 'screen_id' => 'shop_order-add',
144 'title' => __( 'Add New', 'woocommerce' ),
145 )
146 );
147
148 // WooCommerce > Orders > Edit Order.
149 wc_admin_connect_page(
150 array(
151 'id' => 'woocommerce-edit-order',
152 'parent' => 'woocommerce-orders',
153 'screen_id' => 'shop_order',
154 'title' => __( 'Edit Order', 'woocommerce' ),
155 )
156 );
157
158 if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
159 // WooCommerce > Orders (COT).
160 wc_admin_connect_page(
161 array(
162 'id' => 'woocommerce-custom-orders',
163 'screen_id' => wc_get_page_screen_id( 'shop-order' ),
164 'title' => __( 'Orders', 'woocommerce' ),
165 'path' => 'admin.php?page=wc-orders',
166 )
167 );
168 }
169
170 // WooCommerce > Coupons.
171 wc_admin_connect_page(
172 array(
173 'id' => 'woocommerce-coupons',
174 'parent' => 'woocommerce-marketing',
175 'screen_id' => 'edit-shop_coupon',
176 'title' => __( 'Coupons', 'woocommerce' ),
177 'path' => add_query_arg( 'post_type', 'shop_coupon', $posttype_list_base ),
178 )
179 );
180
181 // WooCommerce > Coupons > Add New.
182 wc_admin_connect_page(
183 array(
184 'id' => 'woocommerce-add-coupon',
185 'parent' => 'woocommerce-coupons',
186 'screen_id' => 'shop_coupon-add',
187 'title' => __( 'Add New', 'woocommerce' ),
188 )
189 );
190
191 // WooCommerce > Coupons > Edit Coupon.
192 wc_admin_connect_page(
193 array(
194 'id' => 'woocommerce-edit-coupon',
195 'parent' => 'woocommerce-coupons',
196 'screen_id' => 'shop_coupon',
197 'title' => __( 'Edit Coupon', 'woocommerce' ),
198 )
199 );
200
201 // WooCommerce > Products.
202 wc_admin_connect_page(
203 array(
204 'id' => 'woocommerce-products',
205 'screen_id' => 'edit-product',
206 'title' => __( 'Products', 'woocommerce' ),
207 'path' => add_query_arg( 'post_type', 'product', $posttype_list_base ),
208 )
209 );
210
211 // WooCommerce > Products > Add New.
212 wc_admin_connect_page(
213 array(
214 'id' => 'woocommerce-add-product',
215 'parent' => 'woocommerce-products',
216 'screen_id' => 'product-add',
217 'title' => __( 'Add New', 'woocommerce' ),
218 )
219 );
220
221 // WooCommerce > Products > Edit Order.
222 wc_admin_connect_page(
223 array(
224 'id' => 'woocommerce-edit-product',
225 'parent' => 'woocommerce-products',
226 'screen_id' => 'product',
227 'title' => __( 'Edit Product', 'woocommerce' ),
228 )
229 );
230
231 // WooCommerce > Products > Import Products.
232 wc_admin_connect_page(
233 array(
234 'id' => 'woocommerce-import-products',
235 'parent' => 'woocommerce-products',
236 'screen_id' => 'product_page_product_importer',
237 'title' => __( 'Import Products', 'woocommerce' ),
238 )
239 );
240
241 // WooCommerce > Products > Export Products.
242 wc_admin_connect_page(
243 array(
244 'id' => 'woocommerce-export-products',
245 'parent' => 'woocommerce-products',
246 'screen_id' => 'product_page_product_exporter',
247 'title' => __( 'Export Products', 'woocommerce' ),
248 )
249 );
250
251 // WooCommerce > Products > Product categories.
252 wc_admin_connect_page(
253 array(
254 'id' => 'woocommerce-product-categories',
255 'parent' => 'woocommerce-products',
256 'screen_id' => 'edit-product_cat',
257 'title' => __( 'Product categories', 'woocommerce' ),
258 )
259 );
260
261 // WooCommerce > Products > Edit category.
262 wc_admin_connect_page(
263 array(
264 'id' => 'woocommerce-product-edit-category',
265 'parent' => 'woocommerce-products',
266 'screen_id' => 'product_cat',
267 'title' => __( 'Edit category', 'woocommerce' ),
268 )
269 );
270
271 // WooCommerce > Products > Product tags.
272 wc_admin_connect_page(
273 array(
274 'id' => 'woocommerce-product-tags',
275 'parent' => 'woocommerce-products',
276 'screen_id' => 'edit-product_tag',
277 'title' => __( 'Product tags', 'woocommerce' ),
278 )
279 );
280
281 // WooCommerce > Products > Edit tag.
282 wc_admin_connect_page(
283 array(
284 'id' => 'woocommerce-product-edit-tag',
285 'parent' => 'woocommerce-products',
286 'screen_id' => 'product_tag',
287 'title' => __( 'Edit tag', 'woocommerce' ),
288 )
289 );
290
291 // WooCommerce > Products > Attributes.
292 wc_admin_connect_page(
293 array(
294 'id' => 'woocommerce-product-attributes',
295 'parent' => 'woocommerce-products',
296 'screen_id' => 'product_page_product_attributes',
297 'title' => __( 'Attributes', 'woocommerce' ),
298 )
299 );
300
301 // WooCommerce > Products > Reviews.
302 wc_admin_connect_page(
303 array(
304 'id' => 'woocommerce-product-reviews',
305 'parent' => 'woocommerce-products',
306 'screen_id' => 'product_page_product-reviews',
307 'title' => __( 'Product Reviews', 'woocommerce' ),
308 )
309 );
310
311 // WooCommerce > Products > Edit attribute.
312 wc_admin_connect_page(
313 array(
314 'id' => 'woocommerce-product-edit-attribute',
315 'parent' => 'woocommerce-products',
316 'screen_id' => 'product_page_product_attribute-edit',
317 'title' => __( 'Edit attribute', 'woocommerce' ),
318 )
319 );
320