Use wc filter to get status tabs for tools category (https://github.com/woocommerce/woocommerce-admin/pull/6525)
* Use wc filter to get status tabs for tools category * Add testing instructions and changelog entry * Handle PR feedback
This commit is contained in:
parent
f1bac7d787
commit
f0e1e924c8
|
@ -2,6 +2,18 @@
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Use wc filter to get status tabs for tools category #6525
|
||||||
|
|
||||||
|
1. Register a new tab via the filter.
|
||||||
|
```
|
||||||
|
add_filter( 'woocommerce_admin_status_tabs', function ( array $tabs ) {
|
||||||
|
$tabs['my-tools-page'] = __( 'My Tools Page', 'your-text-domain' );
|
||||||
|
return $tabs;
|
||||||
|
} );
|
||||||
|
```
|
||||||
|
2. Enable the new navigation.
|
||||||
|
3. Make sure the menu item for the registered tab is shown under `Tools`.
|
||||||
|
|
||||||
### Add Guards to "Deactivate Plugin" Note Handlers #6532
|
### Add Guards to "Deactivate Plugin" Note Handlers #6532
|
||||||
|
|
||||||
#### Test incompatible WooCommerce version
|
#### Test incompatible WooCommerce version
|
||||||
|
|
|
@ -75,6 +75,7 @@ Release and roadmap notes are available on the [WooCommerce Developers Blog](htt
|
||||||
|
|
||||||
== Unreleased ==
|
== Unreleased ==
|
||||||
|
|
||||||
|
- Dev: Use wc filter to get status tabs for tools category #6525
|
||||||
- Tweak: Remove mobile activity panel toggle #6539
|
- Tweak: Remove mobile activity panel toggle #6539
|
||||||
- Dev: Add nav header component tests #6509
|
- Dev: Add nav header component tests #6509
|
||||||
- Add: Add legacy report items to new navigation #6507
|
- Add: Add legacy report items to new navigation #6507
|
||||||
|
|
|
@ -224,49 +224,9 @@ class CoreMenu {
|
||||||
'menuId' => 'secondary',
|
'menuId' => 'secondary',
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
),
|
),
|
||||||
// Tools category.
|
|
||||||
array(
|
|
||||||
'parent' => 'woocommerce-tools',
|
|
||||||
'title' => __( 'System status', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'tools-system-status',
|
|
||||||
'url' => 'wc-status',
|
|
||||||
'order' => 20,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'parent' => 'woocommerce-tools',
|
|
||||||
'title' => __( 'Import / Export', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'import',
|
|
||||||
'id' => 'tools-import-export',
|
|
||||||
'url' => 'import.php',
|
|
||||||
'migrate' => false,
|
|
||||||
'order' => 10,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'parent' => 'woocommerce-tools',
|
|
||||||
'title' => __( 'Utilities', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'tools-utilities',
|
|
||||||
'url' => 'admin.php?page=wc-status&tab=tools',
|
|
||||||
'order' => 30,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'parent' => 'woocommerce-tools',
|
|
||||||
'title' => __( 'Logs', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'tools-logs',
|
|
||||||
'url' => 'admin.php?page=wc-status&tab=logs',
|
|
||||||
'order' => 40,
|
|
||||||
),
|
|
||||||
array(
|
|
||||||
'parent' => 'woocommerce-tools',
|
|
||||||
'title' => __( 'Scheduled Actions', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'tools-scheduled_actions',
|
|
||||||
'url' => 'admin.php?page=wc-status&tab=action-scheduler',
|
|
||||||
'order' => 50,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
|
// Tools category.
|
||||||
|
self::get_tool_items(),
|
||||||
// WooCommerce Admin items.
|
// WooCommerce Admin items.
|
||||||
$wca_items,
|
$wca_items,
|
||||||
// Settings category.
|
// Settings category.
|
||||||
|
@ -276,6 +236,47 @@ class CoreMenu {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get items for tools category.
|
||||||
|
*
|
||||||
|
* @returna array
|
||||||
|
*/
|
||||||
|
public static function get_tool_items() {
|
||||||
|
$tabs = array(
|
||||||
|
'status' => __( 'System status', 'woocommerce-admin' ),
|
||||||
|
'tools' => __( 'Utilities', 'woocommerce-admin' ),
|
||||||
|
'logs' => __( 'Logs', 'woocommerce-admin' ),
|
||||||
|
);
|
||||||
|
$tabs = apply_filters( 'woocommerce_admin_status_tabs', $tabs );
|
||||||
|
|
||||||
|
$order = 1;
|
||||||
|
$items = array(
|
||||||
|
array(
|
||||||
|
'parent' => 'woocommerce-tools',
|
||||||
|
'title' => __( 'Import / Export', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'import',
|
||||||
|
'id' => 'tools-import-export',
|
||||||
|
'url' => 'import.php',
|
||||||
|
'migrate' => false,
|
||||||
|
'order' => 0,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $tabs as $key => $tab ) {
|
||||||
|
$items[] = array(
|
||||||
|
'parent' => 'woocommerce-tools',
|
||||||
|
'title' => $tab,
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
|
'id' => 'tools-' . $key,
|
||||||
|
'url' => 'wc-status&tab=' . $key,
|
||||||
|
'order' => $order,
|
||||||
|
);
|
||||||
|
$order++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $items;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get legacy report items.
|
* Get legacy report items.
|
||||||
*
|
*
|
||||||
|
@ -386,6 +387,7 @@ class CoreMenu {
|
||||||
'woocommerce',
|
'woocommerce',
|
||||||
'wc-reports',
|
'wc-reports',
|
||||||
'wc-settings',
|
'wc-settings',
|
||||||
|
'wc-status',
|
||||||
);
|
);
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_navigation_core_excluded_items', $excluded_items );
|
return apply_filters( 'woocommerce_navigation_core_excluded_items', $excluded_items );
|
||||||
|
|
Loading…
Reference in New Issue