| 1 |
<?php |
| 2 |
/** |
| 3 |
* LearnPress admin submenu definitions. |
| 4 |
* |
| 5 |
* @package LearnPress |
| 6 |
* @version 1.0.0 |
| 7 |
* @since 4.4.5 |
| 8 |
*/ |
| 9 |
|
| 10 |
use LearnPress\TemplateHooks\Admin\AdminAddonsPage; |
| 11 |
use LearnPress\TemplateHooks\Admin\AdminListStudentsEnrolled; |
| 12 |
use LearnPress\TemplateHooks\Admin\AdminSettingsPage; |
| 13 |
use LearnPress\TemplateHooks\Admin\AdminStatisticsReportTable; |
| 14 |
use LearnPress\TemplateHooks\Admin\AdminToolsPage; |
| 15 |
|
| 16 |
defined( 'ABSPATH' ) || exit; |
| 17 |
|
| 18 |
$menu_items = apply_filters( |
| 19 |
'learn-press/wp-menus', |
| 20 |
[ |
| 21 |
// Statistics - tabbed page. |
| 22 |
'statistic' => [ |
| 23 |
'id' => 'learn-press-statistics', |
| 24 |
'menu_title' => __( 'Statistics', 'learnpress' ), |
| 25 |
'page_title' => __( 'Statistics', 'learnpress' ), |
| 26 |
'capability' => 'manage_options', |
| 27 |
'priority' => 10, |
| 28 |
'callback' => [ AdminStatisticsReportTable::instance(), 'html_statistics' ], |
| 29 |
], |
| 30 |
// Students. |
| 31 |
'student-enrolled' => [ |
| 32 |
'id' => 'learn-press-students-enrolled', |
| 33 |
'menu_title' => __( 'Students', 'learnpress' ), |
| 34 |
'page_title' => __( 'Students', 'learnpress' ), |
| 35 |
'capability' => 'edit_' . LP_COURSE_CPT . 's', |
| 36 |
'priority' => 20, |
| 37 |
'callback' => [ AdminListStudentsEnrolled::instance(), 'admin_page_output' ], |
| 38 |
], |
| 39 |
// Add-ons. |
| 40 |
'addons' => [ |
| 41 |
'id' => 'learn-press-addons', |
| 42 |
'menu_title' => __( 'Add-ons', 'learnpress' ) . '<span class="lp-notify has-addon-update"></span>', |
| 43 |
'page_title' => __( 'LearnPress Add-ons', 'learnpress' ), |
| 44 |
'capability' => 'manage_options', |
| 45 |
'priority' => 20, |
| 46 |
'callback' => [ AdminAddonsPage::instance(), 'html_page' ], |
| 47 |
], |
| 48 |
// Settings. |
| 49 |
'settings' => [ |
| 50 |
'id' => 'learn-press-settings', |
| 51 |
'menu_title' => esc_html__( 'Settings', 'learnpress' ), |
| 52 |
'page_title' => esc_html__( 'LearnPress Settings', 'learnpress' ), |
| 53 |
'capability' => 'manage_options', |
| 54 |
'priority' => 30, |
| 55 |
'callback' => [ AdminSettingsPage::instance(), 'html_page' ], |
| 56 |
], |
| 57 |
// Help Center. |
| 58 |
'help-center' => [ |
| 59 |
'id' => 'learn-press-help-center', |
| 60 |
'menu_title' => __( 'Help Center', 'learnpress' ), |
| 61 |
'page_title' => __( 'LearnPress Help Center', 'learnpress' ), |
| 62 |
'capability' => 'manage_options', |
| 63 |
'priority' => 25, |
| 64 |
'callback' => function () { |
| 65 |
learn_press_admin_view( 'help-center/html-help-center' ); |
| 66 |
}, |
| 67 |
], |
| 68 |
'themes' => [ |
| 69 |
'id' => 'learn-press-themes', |
| 70 |
'menu_title' => __( 'Themes', 'learnpress' ), |
| 71 |
'page_title' => __( 'LearnPress Themes', 'learnpress' ), |
| 72 |
'capability' => 'manage_options', |
| 73 |
'priority' => 25, |
| 74 |
'callback' => function () { |
| 75 |
learn_press_admin_view( 'themes/html-themes' ); |
| 76 |
}, |
| 77 |
], |
| 78 |
// Tools. |
| 79 |
'tools' => [ |
| 80 |
'id' => 'learn-press-tools', |
| 81 |
'menu_title' => __( 'Tools', 'learnpress' ), |
| 82 |
'page_title' => __( 'LearnPress Tools', 'learnpress' ), |
| 83 |
'capability' => 'manage_options', |
| 84 |
'priority' => 40, |
| 85 |
'callback' => [ AdminToolsPage::instance(), 'html_page' ], |
| 86 |
], |
| 87 |
// Taxonomy sub-menus - no callback, only the URL as the slug. |
| 88 |
'categories' => [ |
| 89 |
'id' => 'edit-tags.php?taxonomy=course_category', |
| 90 |
'menu_title' => __( 'Categories', 'learnpress' ), |
| 91 |
'page_title' => __( 'Categories', 'learnpress' ), |
| 92 |
'capability' => 'manage_options', |
| 93 |
'priority' => 1, |
| 94 |
'callback' => false, |
| 95 |
], |
| 96 |
'tags' => [ |
| 97 |
'id' => 'edit-tags.php?taxonomy=course_tag', |
| 98 |
'menu_title' => __( 'Tags', 'learnpress' ), |
| 99 |
'page_title' => __( 'Tags', 'learnpress' ), |
| 100 |
'capability' => 'manage_options', |
| 101 |
'priority' => 2, |
| 102 |
'callback' => false, |
| 103 |
], |
| 104 |
] |
| 105 |
); |
| 106 |
|
| 107 |
$group_menus = apply_filters( |
| 108 |
'learn-press/wp-admin/menu-group', |
| 109 |
[ |
| 110 |
'content' => [ |
| 111 |
'courses' => 'edit.php?post_type=' . LP_COURSE_CPT, |
| 112 |
'lessons' => 'edit.php?post_type=' . LP_LESSON_CPT, |
| 113 |
'quizzes' => 'edit.php?post_type=' . LP_QUIZ_CPT, |
| 114 |
'questions' => 'edit.php?post_type=' . LP_QUESTION_CPT, |
| 115 |
'course_category' => 'edit-tags.php?taxonomy=course_category', |
| 116 |
'course_tag' => 'edit-tags.php?taxonomy=course_tag', |
| 117 |
], |
| 118 |
'operations' => [ |
| 119 |
'orders' => 'edit.php?post_type=' . LP_ORDER_CPT, |
| 120 |
'students' => 'learn-press-students-enrolled', |
| 121 |
'statistics' => 'learn-press-statistics', |
| 122 |
], |
| 123 |
'system' => [ |
| 124 |
'addons' => 'learn-press-addons', |
| 125 |
'themes' => 'learn-press-themes', |
| 126 |
'settings' => 'learn-press-settings', |
| 127 |
'tools' => 'learn-press-tools', |
| 128 |
'help_center' => 'learn-press-help-center', |
| 129 |
], |
| 130 |
] |
| 131 |
); |
| 132 |
|
| 133 |
return [ |
| 134 |
'menus' => $menu_items, |
| 135 |
'group_menus' => $group_menus, |
| 136 |
]; |
| 137 |
|