finalizing subscription moduile, ready to test
This commit is contained in:
@@ -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
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user