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