fix(spa-nav): refresh navigation immediately when modules are toggled
This commit is contained in:
@@ -151,6 +151,10 @@ class ModulesController extends WP_REST_Controller {
|
||||
'success' => true,
|
||||
'module_id' => $module_id,
|
||||
'enabled' => $enabled,
|
||||
'enabled_modules' => ModuleRegistry::get_enabled_modules(),
|
||||
'nav_tree' => class_exists('\WooNooW\Compat\NavigationRegistry')
|
||||
? \WooNooW\Compat\NavigationRegistry::get_frontend_nav_tree()
|
||||
: [],
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ if (! defined('ABSPATH')) exit;
|
||||
class NavigationRegistry
|
||||
{
|
||||
const NAV_OPTION = 'wnw_nav_tree';
|
||||
const NAV_VERSION = '1.3.1'; // Updated Coupons link
|
||||
const NAV_VERSION = '1.3.3'; // Reordered marketing links by usage priority
|
||||
|
||||
/**
|
||||
* Initialize hooks
|
||||
@@ -217,14 +217,19 @@ class NavigationRegistry
|
||||
{
|
||||
$children = [];
|
||||
|
||||
// Coupons - always available
|
||||
$children[] = ['label' => __('Coupons', 'woonoow'), 'mode' => 'spa', 'path' => '/marketing/coupons'];
|
||||
|
||||
// Affiliate - only if module enabled
|
||||
if (\WooNooW\Core\ModuleRegistry::is_enabled('affiliate')) {
|
||||
$children[] = ['label' => __('Affiliates', 'woonoow'), 'mode' => 'spa', 'path' => '/marketing/affiliates'];
|
||||
}
|
||||
|
||||
// Newsletter - only if module enabled
|
||||
if (\WooNooW\Core\ModuleRegistry::is_enabled('newsletter')) {
|
||||
$children[] = ['label' => __('Newsletter', 'woonoow'), 'mode' => 'spa', 'path' => '/marketing/newsletter'];
|
||||
}
|
||||
|
||||
// Coupons - always available
|
||||
$children[] = ['label' => __('Coupons', 'woonoow'), 'mode' => 'spa', 'path' => '/marketing/coupons'];
|
||||
|
||||
return $children;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user