fix(spa-nav): refresh navigation immediately when modules are toggled

This commit is contained in:
Dwindi Ramadhana
2026-06-01 00:58:18 +07:00
parent 5b8882e595
commit 30f2fc2ea6
5 changed files with 59 additions and 17 deletions

View File

@@ -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;
}