Try: Register plugins under separate navigation menu (https://github.com/woocommerce/woocommerce-admin/pull/5513)
* Create separate methods for registering plugin items * Fix add plugin category * Allow scrolling of nav menu * Use group title * Add example plugin items * Make menu item and category methods private * Add analytics pages to navigation * Register home item if dashboard feature is enabled * Allow navigation registration from all wca items * Update example plugin item registration * Update order of menu groups * Update plugins group name to extensions * Remove temporary scroll fixes
This commit is contained in:
parent
dbd7c823f6
commit
88a4ed76eb
|
@ -65,9 +65,14 @@ const Container = ( { menuItems } ) => {
|
||||||
const getMenuItemsByCategory = ( items ) => {
|
const getMenuItemsByCategory = ( items ) => {
|
||||||
return items.reduce( ( acc, item ) => {
|
return items.reduce( ( acc, item ) => {
|
||||||
if ( ! acc[ item.parent ] ) {
|
if ( ! acc[ item.parent ] ) {
|
||||||
acc[ item.parent ] = [ [], [] ];
|
acc[ item.parent ] = [ [], [], [] ];
|
||||||
|
}
|
||||||
|
let index = 0;
|
||||||
|
if ( item.menuId === 'secondary' ) {
|
||||||
|
index = 1;
|
||||||
|
} else if ( item.menuId === 'plugins' ) {
|
||||||
|
index = 2;
|
||||||
}
|
}
|
||||||
const index = item.menuId !== 'secondary' ? 0 : 1;
|
|
||||||
acc[ item.parent ][ index ].push( item );
|
acc[ item.parent ][ index ].push( item );
|
||||||
return acc;
|
return acc;
|
||||||
}, {} );
|
}, {} );
|
||||||
|
@ -97,9 +102,11 @@ const Container = ( { menuItems } ) => {
|
||||||
></NavigationBackButton>
|
></NavigationBackButton>
|
||||||
) }
|
) }
|
||||||
{ categories.map( ( category ) => {
|
{ categories.map( ( category ) => {
|
||||||
const [ primaryItems, secondaryItems ] = categorizedItems[
|
const [
|
||||||
category.id
|
primaryItems,
|
||||||
];
|
secondaryItems,
|
||||||
|
pluginItems,
|
||||||
|
] = categorizedItems[ category.id ] || [ [], [], [] ];
|
||||||
return (
|
return (
|
||||||
<NavigationMenu
|
<NavigationMenu
|
||||||
key={ category.id }
|
key={ category.id }
|
||||||
|
@ -115,6 +122,22 @@ const Container = ( { menuItems } ) => {
|
||||||
) ) }
|
) ) }
|
||||||
</NavigationGroup>
|
</NavigationGroup>
|
||||||
) }
|
) }
|
||||||
|
{ !! pluginItems.length && (
|
||||||
|
<NavigationGroup
|
||||||
|
title={
|
||||||
|
category.id === 'woocommerce'
|
||||||
|
? __(
|
||||||
|
'Extensions',
|
||||||
|
'woocommerce-admin'
|
||||||
|
)
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{ pluginItems.map( ( item ) => (
|
||||||
|
<Item key={ item.id } item={ item } />
|
||||||
|
) ) }
|
||||||
|
</NavigationGroup>
|
||||||
|
) }
|
||||||
{ !! secondaryItems.length && (
|
{ !! secondaryItems.length && (
|
||||||
<NavigationGroup>
|
<NavigationGroup>
|
||||||
{ secondaryItems.map( ( item ) => (
|
{ secondaryItems.map( ( item ) => (
|
||||||
|
|
|
@ -12,7 +12,7 @@ const MyPlugin = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WooNavigationItem item="example-marketing-category-child-2">
|
<WooNavigationItem item="example-category-child-2">
|
||||||
<Button onClick={ handleClick }>
|
<Button onClick={ handleClick }>
|
||||||
{ __( 'JavaScript Example', 'plugin-domain' ) }
|
{ __( 'JavaScript Example', 'plugin-domain' ) }
|
||||||
</Button>
|
</Button>
|
||||||
|
|
|
@ -36,45 +36,43 @@ add_action( 'admin_enqueue_scripts', 'add_navigation_items_register_script' );
|
||||||
*/
|
*/
|
||||||
function add_navigation_items_register_items() {
|
function add_navigation_items_register_items() {
|
||||||
if (
|
if (
|
||||||
! method_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Menu', 'add_category' ) ||
|
! method_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Menu', 'add_plugin_category' ) ||
|
||||||
! method_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Menu', 'add_item' )
|
! method_exists( '\Automattic\WooCommerce\Admin\Features\Navigation\Menu', 'add_plugin_item' )
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_item(
|
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_plugin_item(
|
||||||
array(
|
array(
|
||||||
'id' => 'example-marketing-plugin',
|
'id' => 'example-plugin',
|
||||||
'title' => 'Example Marketing Settings',
|
'title' => 'Example Plugin',
|
||||||
'capability' => 'view_woocommerce_reports',
|
'capability' => 'view_woocommerce_reports',
|
||||||
'parent' => 'settings',
|
|
||||||
'url' => 'https://www.google.com',
|
'url' => 'https://www.google.com',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_category(
|
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_plugin_category(
|
||||||
array(
|
array(
|
||||||
'id' => 'example-marketing-category',
|
'id' => 'example-category',
|
||||||
'parent' => 'woocommerce-marketing',
|
'title' => 'Example Category',
|
||||||
'title' => 'Example Marketing Category',
|
|
||||||
'capability' => 'view_woocommerce_reports',
|
'capability' => 'view_woocommerce_reports',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_item(
|
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_plugin_item(
|
||||||
array(
|
array(
|
||||||
'id' => 'example-marketing-category-child-1',
|
'id' => 'example-category-child-1',
|
||||||
'parent' => 'example-marketing-category',
|
'parent' => 'example-category',
|
||||||
'title' => 'Sub Menu Child 1',
|
'title' => 'Sub Menu Child 1',
|
||||||
'capability' => 'view_woocommerce_reports',
|
'capability' => 'view_woocommerce_reports',
|
||||||
'url' => 'https://www.google.com',
|
'url' => 'https://www.google.com',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_item(
|
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_plugin_item(
|
||||||
array(
|
array(
|
||||||
'id' => 'example-marketing-category-child-2',
|
'id' => 'example-category-child-2',
|
||||||
'parent' => 'example-marketing-category',
|
'parent' => 'example-category',
|
||||||
'title' => 'Sub Menu Child 2',
|
'title' => 'Sub Menu Child 2',
|
||||||
'capability' => 'view_woocommerce_reports',
|
'capability' => 'view_woocommerce_reports',
|
||||||
'url' => 'https://www.google.com',
|
'url' => 'https://www.google.com',
|
||||||
|
|
|
@ -112,17 +112,24 @@ class Analytics {
|
||||||
* Registers report pages.
|
* Registers report pages.
|
||||||
*/
|
*/
|
||||||
public function register_pages() {
|
public function register_pages() {
|
||||||
$navigation_enabled = Loader::is_feature_enabled( 'navigation' );
|
$report_pages = self::get_report_pages();
|
||||||
|
foreach ( $report_pages as $report_page ) {
|
||||||
|
if ( ! is_null( $report_page ) ) {
|
||||||
|
wc_admin_register_page( $report_page );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get report pages.
|
||||||
|
*/
|
||||||
|
public static function get_report_pages() {
|
||||||
$overview_page = array(
|
$overview_page = array(
|
||||||
'id' => 'woocommerce-analytics',
|
'id' => 'woocommerce-analytics',
|
||||||
'title' => __( 'Analytics', 'woocommerce-admin' ),
|
'title' => __( 'Analytics', 'woocommerce-admin' ),
|
||||||
'path' => '/analytics/overview',
|
'path' => '/analytics/overview',
|
||||||
'icon' => 'dashicons-chart-bar',
|
'icon' => 'dashicons-chart-bar',
|
||||||
'position' => 56, // After WooCommerce & Product menu items.
|
'position' => 56, // After WooCommerce & Product menu items.
|
||||||
'order' => 10,
|
|
||||||
'is_category' => true,
|
|
||||||
'is_top_level' => true,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$report_pages = array(
|
$report_pages = array(
|
||||||
|
@ -132,94 +139,124 @@ class Analytics {
|
||||||
'title' => __( 'Overview', 'woocommerce-admin' ),
|
'title' => __( 'Overview', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/overview',
|
'path' => '/analytics/overview',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-products',
|
'id' => 'woocommerce-analytics-products',
|
||||||
'title' => __( 'Products', 'woocommerce-admin' ),
|
'title' => __( 'Products', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/products',
|
'path' => '/analytics/products',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 20,
|
'order' => 20,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-revenue',
|
'id' => 'woocommerce-analytics-revenue',
|
||||||
'title' => __( 'Revenue', 'woocommerce-admin' ),
|
'title' => __( 'Revenue', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/revenue',
|
'path' => '/analytics/revenue',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 30,
|
'order' => 30,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-orders',
|
'id' => 'woocommerce-analytics-orders',
|
||||||
'title' => __( 'Orders', 'woocommerce-admin' ),
|
'title' => __( 'Orders', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/orders',
|
'path' => '/analytics/orders',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 40,
|
'order' => 40,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-variations',
|
'id' => 'woocommerce-analytics-variations',
|
||||||
'title' => __( 'Variations', 'woocommerce-admin' ),
|
'title' => __( 'Variations', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/variations',
|
'path' => '/analytics/variations',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 50,
|
'order' => 50,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-categories',
|
'id' => 'woocommerce-analytics-categories',
|
||||||
'title' => __( 'Categories', 'woocommerce-admin' ),
|
'title' => __( 'Categories', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/categories',
|
'path' => '/analytics/categories',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 60,
|
'order' => 60,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-coupons',
|
'id' => 'woocommerce-analytics-coupons',
|
||||||
'title' => __( 'Coupons', 'woocommerce-admin' ),
|
'title' => __( 'Coupons', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/coupons',
|
'path' => '/analytics/coupons',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 70,
|
'order' => 70,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-taxes',
|
'id' => 'woocommerce-analytics-taxes',
|
||||||
'title' => __( 'Taxes', 'woocommerce-admin' ),
|
'title' => __( 'Taxes', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/taxes',
|
'path' => '/analytics/taxes',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 80,
|
'order' => 80,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-downloads',
|
'id' => 'woocommerce-analytics-downloads',
|
||||||
'title' => __( 'Downloads', 'woocommerce-admin' ),
|
'title' => __( 'Downloads', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/downloads',
|
'path' => '/analytics/downloads',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 90,
|
'order' => 90,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'yes' === get_option( 'woocommerce_manage_stock' ) ? array(
|
'yes' === get_option( 'woocommerce_manage_stock' ) ? array(
|
||||||
'id' => 'woocommerce-analytics-stock',
|
'id' => 'woocommerce-analytics-stock',
|
||||||
'title' => __( 'Stock', 'woocommerce-admin' ),
|
'title' => __( 'Stock', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/stock',
|
'path' => '/analytics/stock',
|
||||||
|
'nav_args' => array(
|
||||||
'order' => 100,
|
'order' => 100,
|
||||||
|
'parent' => 'analytics',
|
||||||
|
),
|
||||||
) : null,
|
) : null,
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-customers',
|
'id' => 'woocommerce-analytics-customers',
|
||||||
'title' => __( 'Customers', 'woocommerce-admin' ),
|
'title' => __( 'Customers', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce',
|
'parent' => 'woocommerce',
|
||||||
'path' => '/customers',
|
'path' => '/customers',
|
||||||
|
'nav_args' => array(
|
||||||
'is_top_level' => true,
|
'is_top_level' => true,
|
||||||
'order' => 50,
|
'order' => 50,
|
||||||
),
|
),
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'id' => 'woocommerce-analytics-settings',
|
'id' => 'woocommerce-analytics-settings',
|
||||||
'title' => $navigation_enabled ? __( 'Analytics', 'woocommerce-admin' ) : __( 'Settings', 'woocommerce-admin' ),
|
'title' => __( 'Settings', 'woocommerce-admin' ),
|
||||||
'parent' => $navigation_enabled ? 'settings' : 'woocommerce-analytics',
|
'parent' => 'woocommerce-analytics',
|
||||||
'path' => '/analytics/settings',
|
'path' => '/analytics/settings',
|
||||||
|
'nav_args' => array(
|
||||||
|
'title' => __( 'Analytics', 'woocommerce-admin' ),
|
||||||
|
'parent' => 'settings',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$report_pages = apply_filters( 'woocommerce_analytics_report_menu_items', $report_pages );
|
return apply_filters( 'woocommerce_analytics_report_menu_items', $report_pages );
|
||||||
|
|
||||||
foreach ( $report_pages as $report_page ) {
|
|
||||||
if ( ! is_null( $report_page ) ) {
|
|
||||||
wc_admin_register_page( $report_page );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,8 +88,6 @@ class AnalyticsDashboard {
|
||||||
'title' => __( 'Home', 'woocommerce-admin' ),
|
'title' => __( 'Home', 'woocommerce-admin' ),
|
||||||
'parent' => 'woocommerce',
|
'parent' => 'woocommerce',
|
||||||
'path' => self::MENU_SLUG,
|
'path' => self::MENU_SLUG,
|
||||||
'is_top_level' => true,
|
|
||||||
'order' => 0,
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,9 @@ class Marketing {
|
||||||
'title' => __( 'Overview', 'woocommerce-admin' ),
|
'title' => __( 'Overview', 'woocommerce-admin' ),
|
||||||
'path' => 'wc-admin&path=/marketing',
|
'path' => 'wc-admin&path=/marketing',
|
||||||
'parent' => 'woocommerce-marketing',
|
'parent' => 'woocommerce-marketing',
|
||||||
|
'nav_args' => array(
|
||||||
|
'parent' => 'marketing',
|
||||||
|
),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ namespace Automattic\WooCommerce\Admin\Features\Navigation;
|
||||||
use Automattic\WooCommerce\Admin\Features\Navigation\Menu;
|
use Automattic\WooCommerce\Admin\Features\Navigation\Menu;
|
||||||
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
|
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CoreMenu class. Handles registering Core menu items.
|
* CoreMenu class. Handles registering Core menu items.
|
||||||
*/
|
*/
|
||||||
|
@ -36,25 +35,24 @@ class CoreMenu {
|
||||||
* Init.
|
* Init.
|
||||||
*/
|
*/
|
||||||
public function init() {
|
public function init() {
|
||||||
add_action( 'admin_menu', array( $this, 'add_core_items' ) );
|
add_action( 'admin_menu', array( $this, 'register_post_types' ) );
|
||||||
add_action( 'admin_menu', array( $this, 'add_core_setting_items' ) );
|
|
||||||
add_filter( 'add_menu_classes', array( $this, 'migrate_child_items' ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add registered admin settings as menu items.
|
* Add registered admin settings as menu items.
|
||||||
*/
|
*/
|
||||||
public function add_core_setting_items() {
|
public static function get_setting_items() {
|
||||||
$setting_pages = \WC_Admin_Settings::get_settings_pages();
|
$setting_pages = \WC_Admin_Settings::get_settings_pages();
|
||||||
$settings = array();
|
$settings = array();
|
||||||
foreach ( $setting_pages as $setting_page ) {
|
foreach ( $setting_pages as $setting_page ) {
|
||||||
$settings = $setting_page->add_settings_page( $settings );
|
$settings = $setting_page->add_settings_page( $settings );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$menu_items = array();
|
||||||
$order = 0;
|
$order = 0;
|
||||||
foreach ( $settings as $key => $setting ) {
|
foreach ( $settings as $key => $setting ) {
|
||||||
$order += 10;
|
$order += 10;
|
||||||
Menu::add_item(
|
$menu_items[] = (
|
||||||
array(
|
array(
|
||||||
'parent' => 'settings',
|
'parent' => 'settings',
|
||||||
'title' => $setting,
|
'title' => $setting,
|
||||||
|
@ -65,34 +63,45 @@ class CoreMenu {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $menu_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the core menu items to the new navigation
|
* Get all menu categories.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function add_core_items() {
|
public static function get_categories() {
|
||||||
// Orders category.
|
return array(
|
||||||
Screen::register_post_type( 'shop_order', null );
|
array(
|
||||||
Menu::add_post_type_category( 'shop_order', array( 'order' => 20 ) );
|
'title' => __( 'Analytics', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
// Products category.
|
'id' => 'analytics',
|
||||||
Screen::register_post_type( 'product', null );
|
'order' => 10,
|
||||||
Menu::add_post_type_category( 'product', array( 'order' => 40 ) );
|
'is_top_level' => true,
|
||||||
|
),
|
||||||
// Marketing category.
|
array(
|
||||||
Menu::add_category(
|
'title' => __( 'Orders', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
|
'id' => 'orders',
|
||||||
|
'order' => 20,
|
||||||
|
'is_top_level' => true,
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Marketing', 'woocommerce-admin' ),
|
'title' => __( 'Marketing', 'woocommerce-admin' ),
|
||||||
'capability' => 'manage_woocommerce',
|
'capability' => 'manage_woocommerce',
|
||||||
'id' => 'woocommerce-marketing',
|
'id' => 'marketing',
|
||||||
'order' => 30,
|
'order' => 30,
|
||||||
'is_top_level' => true,
|
'is_top_level' => true,
|
||||||
)
|
),
|
||||||
);
|
array(
|
||||||
Screen::register_post_type( 'shop_coupon', 'woocommerce-marketing' );
|
'title' => __( 'Products', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
// Extensions category.
|
'id' => 'products',
|
||||||
Menu::add_category(
|
'order' => 40,
|
||||||
|
'is_top_level' => true,
|
||||||
|
),
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Extensions', 'woocommerce-admin' ),
|
'title' => __( 'Extensions', 'woocommerce-admin' ),
|
||||||
'capability' => 'activate_plugins',
|
'capability' => 'activate_plugins',
|
||||||
|
@ -101,30 +110,7 @@ class CoreMenu {
|
||||||
'menuId' => 'secondary',
|
'menuId' => 'secondary',
|
||||||
'order' => 20,
|
'order' => 20,
|
||||||
'is_top_level' => true,
|
'is_top_level' => true,
|
||||||
)
|
),
|
||||||
);
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
|
||||||
'parent' => 'extensions',
|
|
||||||
'title' => __( 'My extensions', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'my-extensions',
|
|
||||||
'url' => 'plugins.php',
|
|
||||||
'migrate' => false,
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
|
||||||
'parent' => 'extensions',
|
|
||||||
'title' => __( 'Marketplace', 'woocommerce-admin' ),
|
|
||||||
'capability' => 'manage_woocommerce',
|
|
||||||
'id' => 'marketplace',
|
|
||||||
'url' => 'wc-addons',
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Settings category.
|
|
||||||
Menu::add_category(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Settings', 'woocommerce-admin' ),
|
'title' => __( 'Settings', 'woocommerce-admin' ),
|
||||||
'capability' => 'manage_woocommerce',
|
'capability' => 'manage_woocommerce',
|
||||||
|
@ -133,11 +119,7 @@ class CoreMenu {
|
||||||
'order' => 10,
|
'order' => 10,
|
||||||
'url' => 'admin.php?page=wc-settings',
|
'url' => 'admin.php?page=wc-settings',
|
||||||
'is_top_level' => true,
|
'is_top_level' => true,
|
||||||
)
|
),
|
||||||
);
|
|
||||||
|
|
||||||
// Tools category.
|
|
||||||
Menu::add_category(
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Tools', 'woocommerce-admin' ),
|
'title' => __( 'Tools', 'woocommerce-admin' ),
|
||||||
'capability' => 'manage_woocommerce',
|
'capability' => 'manage_woocommerce',
|
||||||
|
@ -145,18 +127,81 @@ class CoreMenu {
|
||||||
'menuId' => 'secondary',
|
'menuId' => 'secondary',
|
||||||
'order' => 30,
|
'order' => 30,
|
||||||
'is_top_level' => true,
|
'is_top_level' => true,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
Menu::add_item(
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all menu items.
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function get_items() {
|
||||||
|
$order_items = Menu::get_post_type_items( 'shop_order', array( 'parent' => 'orders' ) );
|
||||||
|
$product_items = Menu::get_post_type_items( 'product', array( 'parent' => 'products' ) );
|
||||||
|
$coupon_items = Menu::get_post_type_items( 'shop_coupon', array( 'parent' => 'marketing' ) );
|
||||||
|
$setting_items = self::get_setting_items();
|
||||||
|
$wca_items = array();
|
||||||
|
$wca_pages = \Automattic\WooCommerce\Admin\PageController::get_instance()->get_pages();
|
||||||
|
|
||||||
|
foreach ( $wca_pages as $page ) {
|
||||||
|
if ( ! isset( $page['nav_args'] ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$wca_items[] = array_merge(
|
||||||
|
array(
|
||||||
|
'id' => $page['id'],
|
||||||
|
'url' => $page['path'],
|
||||||
|
'title' => $page['title'][0],
|
||||||
|
'capability' => $page['capability'],
|
||||||
|
),
|
||||||
|
$page['nav_args']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$home_item = array();
|
||||||
|
if ( defined( '\Automattic\WooCommerce\Admin\Features\AnalyticsDashboard::MENU_SLUG' ) ) {
|
||||||
|
$home_item = array(
|
||||||
|
'id' => 'home',
|
||||||
|
'title' => __( 'Home', 'woocommerce-admin' ),
|
||||||
|
'url' => \Automattic\WooCommerce\Admin\Features\AnalyticsDashboard::MENU_SLUG,
|
||||||
|
'is_top_level' => true,
|
||||||
|
'order' => 0,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return array_merge(
|
||||||
|
array(
|
||||||
|
$home_item,
|
||||||
|
$order_items[1],
|
||||||
|
$product_items[1],
|
||||||
|
$product_items[2],
|
||||||
|
$coupon_items[0],
|
||||||
|
// Extensions category.
|
||||||
|
array(
|
||||||
|
'parent' => 'extensions',
|
||||||
|
'title' => __( 'My extensions', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
|
'id' => 'my-extensions',
|
||||||
|
'url' => 'plugins.php',
|
||||||
|
'migrate' => false,
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'parent' => 'extensions',
|
||||||
|
'title' => __( 'Marketplace', 'woocommerce-admin' ),
|
||||||
|
'capability' => 'manage_woocommerce',
|
||||||
|
'id' => 'marketplace',
|
||||||
|
'url' => 'wc-addons',
|
||||||
|
),
|
||||||
|
// Tools category.
|
||||||
array(
|
array(
|
||||||
'parent' => 'tools',
|
'parent' => 'tools',
|
||||||
'title' => __( 'System status', 'woocommerce-admin' ),
|
'title' => __( 'System status', 'woocommerce-admin' ),
|
||||||
'capability' => 'manage_woocommerce',
|
'capability' => 'manage_woocommerce',
|
||||||
'id' => 'system-status',
|
'id' => 'system-status',
|
||||||
'url' => 'wc-status',
|
'url' => 'wc-status',
|
||||||
)
|
),
|
||||||
);
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
array(
|
||||||
'parent' => 'tools',
|
'parent' => 'tools',
|
||||||
'title' => __( 'Import / Export', 'woocommerce-admin' ),
|
'title' => __( 'Import / Export', 'woocommerce-admin' ),
|
||||||
|
@ -164,19 +209,31 @@ class CoreMenu {
|
||||||
'id' => 'import-export',
|
'id' => 'import-export',
|
||||||
'url' => 'import.php',
|
'url' => 'import.php',
|
||||||
'migrate' => false,
|
'migrate' => false,
|
||||||
)
|
),
|
||||||
);
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
array(
|
||||||
'parent' => 'tools',
|
'parent' => 'tools',
|
||||||
'title' => __( 'Utilities', 'woocommerce-admin' ),
|
'title' => __( 'Utilities', 'woocommerce-admin' ),
|
||||||
'capability' => 'manage_woocommerce',
|
'capability' => 'manage_woocommerce',
|
||||||
'id' => 'utilities',
|
'id' => 'utilities',
|
||||||
'url' => 'admin.php?page=wc-status&tab=tools',
|
'url' => 'admin.php?page=wc-status&tab=tools',
|
||||||
)
|
),
|
||||||
|
),
|
||||||
|
// WooCommerce Admin items.
|
||||||
|
$wca_items,
|
||||||
|
// Settings category.
|
||||||
|
$setting_items
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register all core post types.
|
||||||
|
*/
|
||||||
|
public function register_post_types() {
|
||||||
|
Screen::register_post_type( 'shop_order' );
|
||||||
|
Screen::register_post_type( 'product' );
|
||||||
|
Screen::register_post_type( 'shop_coupon' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get items excluded from WooCommerce menu migration.
|
* Get items excluded from WooCommerce menu migration.
|
||||||
*
|
*
|
||||||
|
@ -190,42 +247,4 @@ class CoreMenu {
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_navigation_core_excluded_items', $excluded_items );
|
return apply_filters( 'woocommerce_navigation_core_excluded_items', $excluded_items );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Migrate any remaining WooCommerce child items.
|
|
||||||
*
|
|
||||||
* @param array $menu Menu items.
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function migrate_child_items( $menu ) {
|
|
||||||
global $submenu;
|
|
||||||
|
|
||||||
if ( ! isset( $submenu['woocommerce'] ) ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ( $submenu['woocommerce'] as $menu_item ) {
|
|
||||||
if ( in_array( $menu_item[2], self::get_excluded_items(), true ) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't add already added items.
|
|
||||||
$callbacks = Menu::instance()::get_callbacks();
|
|
||||||
if ( array_key_exists( $menu_item[2], $callbacks ) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
|
||||||
'parent' => 'settings',
|
|
||||||
'title' => $menu_item[0],
|
|
||||||
'capability' => $menu_item[1],
|
|
||||||
'id' => sanitize_title( $menu_item[0] ),
|
|
||||||
'url' => $menu_item[2],
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $menu;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
namespace Automattic\WooCommerce\Admin\Features\Navigation;
|
namespace Automattic\WooCommerce\Admin\Features\Navigation;
|
||||||
|
|
||||||
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
|
use Automattic\WooCommerce\Admin\Features\Navigation\Screen;
|
||||||
|
use Automattic\WooCommerce\Admin\Features\Navigation\CoreMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains logic for the WooCommerce Navigation menu.
|
* Contains logic for the WooCommerce Navigation menu.
|
||||||
|
@ -83,8 +84,10 @@ class Menu {
|
||||||
* Init.
|
* Init.
|
||||||
*/
|
*/
|
||||||
public function init() {
|
public function init() {
|
||||||
|
add_action( 'admin_menu', array( $this, 'add_core_items' ) );
|
||||||
add_filter( 'admin_enqueue_scripts', array( $this, 'enqueue_data' ), 20 );
|
add_filter( 'admin_enqueue_scripts', array( $this, 'enqueue_data' ), 20 );
|
||||||
add_filter( 'add_menu_classes', array( $this, 'migrate_menu_items' ), 30 );
|
add_filter( 'add_menu_classes', array( $this, 'migrate_menu_items' ), 30 );
|
||||||
|
add_filter( 'add_menu_classes', array( $this, 'migrate_core_child_items' ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -150,7 +153,7 @@ class Menu {
|
||||||
* 'menuId' => (string) The ID of the menu to add the category to.
|
* 'menuId' => (string) The ID of the menu to add the category to.
|
||||||
* ).
|
* ).
|
||||||
*/
|
*/
|
||||||
public static function add_category( $args ) {
|
private static function add_category( $args ) {
|
||||||
if ( ! isset( $args['id'] ) || isset( self::$menu_items[ $args['id'] ] ) ) {
|
if ( ! isset( $args['id'] ) || isset( self::$menu_items[ $args['id'] ] ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -202,7 +205,7 @@ class Menu {
|
||||||
* 'menuId' => (string) The ID of the menu to add the item to.
|
* 'menuId' => (string) The ID of the menu to add the item to.
|
||||||
* ).
|
* ).
|
||||||
*/
|
*/
|
||||||
public static function add_item( $args ) {
|
private static function add_item( $args ) {
|
||||||
if ( ! isset( $args['id'] ) || isset( self::$menu_items[ $args['id'] ] ) ) {
|
if ( ! isset( $args['id'] ) || isset( self::$menu_items[ $args['id'] ] ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -235,6 +238,57 @@ class Menu {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a plugin item.
|
||||||
|
*
|
||||||
|
* @param array $args Array containing the necessary arguments.
|
||||||
|
* $args = array(
|
||||||
|
* 'id' => (string) The unique ID of the menu item. Required.
|
||||||
|
* 'title' => (string) Title of the menu item. Required.
|
||||||
|
* 'parent' => (string) Parent menu item ID.
|
||||||
|
* 'capability' => (string) Capability to view this menu item.
|
||||||
|
* 'url' => (string) URL or callback to be used. Required.
|
||||||
|
* 'order' => (int) Menu item order.
|
||||||
|
* 'migrate' => (bool) Whether or not to hide the item in the wp admin menu.
|
||||||
|
* 'menuId' => (string) The ID of the menu to add the item to.
|
||||||
|
* ).
|
||||||
|
*/
|
||||||
|
public static function add_plugin_item( $args ) {
|
||||||
|
$item_args = array_merge(
|
||||||
|
$args,
|
||||||
|
array(
|
||||||
|
'menuId' => 'plugins',
|
||||||
|
'is_top_level' => ! isset( $args['parent'] ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
self::add_item( $item_args );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a plugin category.
|
||||||
|
*
|
||||||
|
* @param array $args Array containing the necessary arguments.
|
||||||
|
* $args = array(
|
||||||
|
* 'id' => (string) The unique ID of the menu item. Required.
|
||||||
|
* 'title' => (string) Title of the menu item. Required.
|
||||||
|
* 'capability' => (string) Capability to view this menu item.
|
||||||
|
* 'url' => (string) URL or callback to be used. Required.
|
||||||
|
* 'order' => (int) Menu item order.
|
||||||
|
* 'migrate' => (bool) Whether or not to hide the item in the wp admin menu.
|
||||||
|
* 'menuId' => (string) The ID of the menu to add the category to.
|
||||||
|
* ).
|
||||||
|
*/
|
||||||
|
public static function add_plugin_category( $args ) {
|
||||||
|
$category_args = array_merge(
|
||||||
|
$args,
|
||||||
|
array(
|
||||||
|
'menuId' => 'plugins',
|
||||||
|
'is_top_level' => ! isset( $args['parent'] ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
self::add_category( $category_args );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a post type as a menu category.
|
* Adds a post type as a menu category.
|
||||||
*
|
*
|
||||||
|
@ -279,6 +333,106 @@ class Menu {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get menu item templates for a given post type.
|
||||||
|
*
|
||||||
|
* @param string $post_type Post type to add.
|
||||||
|
* @param array $menu_args Arguments merged with the returned menu items.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public static function get_post_type_items( $post_type, $menu_args = array() ) {
|
||||||
|
$post_type_object = get_post_type_object( $post_type );
|
||||||
|
|
||||||
|
if ( ! $post_type_object || ! $post_type_object->show_in_menu ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return array(
|
||||||
|
array_merge(
|
||||||
|
array(
|
||||||
|
'title' => esc_attr( $post_type_object->labels->menu_name ),
|
||||||
|
'capability' => $post_type_object->cap->edit_posts,
|
||||||
|
'id' => $post_type,
|
||||||
|
'url' => "edit.php?post_type={$post_type}",
|
||||||
|
),
|
||||||
|
$menu_args
|
||||||
|
),
|
||||||
|
array_merge(
|
||||||
|
array(
|
||||||
|
'parent' => $post_type,
|
||||||
|
'title' => esc_attr( $post_type_object->labels->all_items ),
|
||||||
|
'capability' => $post_type_object->cap->edit_posts,
|
||||||
|
'id' => "{$post_type}-all-items",
|
||||||
|
'url' => "edit.php?post_type={$post_type}",
|
||||||
|
),
|
||||||
|
$menu_args
|
||||||
|
),
|
||||||
|
array_merge(
|
||||||
|
array(
|
||||||
|
'parent' => $post_type,
|
||||||
|
'title' => esc_attr( $post_type_object->labels->add_new ),
|
||||||
|
'capability' => $post_type_object->cap->create_posts,
|
||||||
|
'id' => "{$post_type}-add-new",
|
||||||
|
'url' => "post-new.php?post_type={$post_type}",
|
||||||
|
),
|
||||||
|
$menu_args
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add core menu items.
|
||||||
|
*/
|
||||||
|
public function add_core_items() {
|
||||||
|
$categories = CoreMenu::get_categories();
|
||||||
|
foreach ( $categories as $category ) {
|
||||||
|
self::add_category( $category );
|
||||||
|
}
|
||||||
|
|
||||||
|
$items = CoreMenu::get_items();
|
||||||
|
foreach ( $items as $item ) {
|
||||||
|
self::add_item( $item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Migrate any remaining WooCommerce child items.
|
||||||
|
*
|
||||||
|
* @param array $menu Menu items.
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function migrate_core_child_items( $menu ) {
|
||||||
|
global $submenu;
|
||||||
|
|
||||||
|
if ( ! isset( $submenu['woocommerce'] ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $submenu['woocommerce'] as $menu_item ) {
|
||||||
|
if ( in_array( $menu_item[2], CoreMenu::get_excluded_items(), true ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Don't add already added items.
|
||||||
|
$callbacks = self::get_callbacks();
|
||||||
|
if ( array_key_exists( $menu_item[2], $callbacks ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
self::add_item(
|
||||||
|
array(
|
||||||
|
'parent' => 'settings',
|
||||||
|
'title' => $menu_item[0],
|
||||||
|
'capability' => $menu_item[1],
|
||||||
|
'id' => sanitize_title( $menu_item[0] ),
|
||||||
|
'url' => $menu_item[2],
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $menu;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides all WP admin menus items and adds screen IDs to check for new items.
|
* Hides all WP admin menus items and adds screen IDs to check for new items.
|
||||||
*
|
*
|
||||||
|
|
|
@ -168,25 +168,8 @@ class Screen {
|
||||||
* Register post type for use in WooCommerce Navigation screens.
|
* Register post type for use in WooCommerce Navigation screens.
|
||||||
*
|
*
|
||||||
* @param string $post_type Post type to add.
|
* @param string $post_type Post type to add.
|
||||||
* @param string $parent_id Parent menu item ID.
|
|
||||||
*/
|
*/
|
||||||
public static function register_post_type( $post_type, $parent_id ) {
|
public static function register_post_type( $post_type ) {
|
||||||
self::$post_types[] = $post_type;
|
self::$post_types[] = $post_type;
|
||||||
|
|
||||||
$post_type_object = get_post_type_object( $post_type );
|
|
||||||
|
|
||||||
if ( ! $post_type_object || ! $post_type_object->show_in_menu || ! $parent_id ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Menu::add_item(
|
|
||||||
array(
|
|
||||||
'parent' => $parent_id,
|
|
||||||
'title' => esc_attr( $post_type_object->labels->menu_name ),
|
|
||||||
'capability' => $post_type_object->cap->edit_posts,
|
|
||||||
'id' => $post_type,
|
|
||||||
'url' => "edit.php?post_type={$post_type}",
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -453,47 +453,16 @@ class PageController {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::add_nav_item( $options );
|
|
||||||
$this->connect_page( $options );
|
$this->connect_page( $options );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the item to the WooCommerce Navigation menu.
|
* Get registered pages.
|
||||||
*
|
*
|
||||||
* @param array $options {
|
* @return array
|
||||||
* Array describing the page.
|
|
||||||
*
|
|
||||||
* @type string id Id to reference the page.
|
|
||||||
* @type string title Page title. Used in menus and breadcrumbs.
|
|
||||||
* @type string|null parent Parent ID. Null for new top level page.
|
|
||||||
* @type string path Path for this page, full path in app context; ex /analytics/report
|
|
||||||
* @type string capability Capability needed to access the page.
|
|
||||||
* @type string icon Icon. Dashicons helper class, base64-encoded SVG, or 'none'.
|
|
||||||
* @type int order Navigation item order.
|
|
||||||
* }
|
|
||||||
*/
|
*/
|
||||||
public static function add_nav_item( $options ) {
|
public function get_pages() {
|
||||||
$navigation_enabled = Loader::is_feature_enabled( 'navigation' );
|
return $this->pages;
|
||||||
|
|
||||||
if ( ! $navigation_enabled ) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$item_options = array(
|
|
||||||
'id' => $options['id'],
|
|
||||||
'parent' => $options['parent'],
|
|
||||||
'title' => $options['title'],
|
|
||||||
'capability' => $options['capability'],
|
|
||||||
'url' => $options['path'],
|
|
||||||
'order' => isset( $options['order'] ) ? $options['order'] : 100,
|
|
||||||
'is_top_level' => ( isset( $options['is_top_level'] ) && $options['is_top_level'] ) || ! $options['parent'],
|
|
||||||
);
|
|
||||||
|
|
||||||
if ( isset( $options['is_category'] ) && $options['is_category'] ) {
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_category( $item_options );
|
|
||||||
} else {
|
|
||||||
\Automattic\WooCommerce\Admin\Features\Navigation\Menu::add_item( $item_options );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue