finalizing subscription moduile, ready to test

This commit is contained in:
Dwindi Ramadhana
2026-01-29 11:54:42 +07:00
parent 6d2136d3b5
commit d80f34c8b9
34 changed files with 5619 additions and 468 deletions

View File

@@ -13,7 +13,7 @@ if ( ! defined('ABSPATH') ) exit;
*/
class NavigationRegistry {
const NAV_OPTION = 'wnw_nav_tree';
const NAV_VERSION = '1.2.0'; // Added Menus (Menu Editor)
const NAV_VERSION = '1.3.0'; // Added Subscriptions section
/**
* Initialize hooks
@@ -132,6 +132,8 @@ class NavigationRegistry {
// Future: Drafts, Recurring, etc.
],
],
// Subscriptions - only if module enabled
...self::get_subscriptions_section(),
[
'key' => 'products',
'label' => __('Products', 'woonoow'),
@@ -242,6 +244,30 @@ class NavigationRegistry {
return $children;
}
/**
* Get subscriptions navigation section
* Returns empty array if module is not enabled
*
* @return array Subscriptions section or empty array
*/
private static function get_subscriptions_section(): array {
if (!\WooNooW\Core\ModuleRegistry::is_enabled('subscription')) {
return [];
}
return [
[
'key' => 'subscriptions',
'label' => __('Subscriptions', 'woonoow'),
'path' => '/subscriptions',
'icon' => 'repeat',
'children' => [
['label' => __('All Subscriptions', 'woonoow'), 'mode' => 'spa', 'path' => '/subscriptions', 'exact' => true],
],
],
];
}
/**
* Get the complete navigation tree
*