Add plugin configs to sidebar menu
This commit is contained in:
parent
ada46e567c
commit
6d579f8b1e
|
|
@ -148,6 +148,30 @@ if (! function_exists('bs_menu')) {
|
|||
throw new InvalidArgumentException;
|
||||
}
|
||||
|
||||
$menu[$type] = array_map(function ($item) {
|
||||
if (Arr::get($item, 'id') === 'plugin-configs') {
|
||||
$availablePluginConfigs = [];
|
||||
|
||||
foreach (app('plugins')->getEnabledPlugins() as $plugin) {
|
||||
if ($plugin->hasConfigView()) {
|
||||
$availablePluginConfigs[] = [
|
||||
'title' => trans($plugin->title),
|
||||
'link' => 'admin/plugins/config/'.$plugin->name,
|
||||
'icon' => 'fa-circle-o'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
// Don't display this menu item when no plugin config is available
|
||||
if (count($availablePluginConfigs) > 0) {
|
||||
$item['children'] = array_merge($item['children'], $availablePluginConfigs);
|
||||
return $item;
|
||||
}
|
||||
} else {
|
||||
return $item;
|
||||
}
|
||||
}, $menu[$type]);
|
||||
|
||||
return bs_menu_render($menu[$type]);
|
||||
}
|
||||
|
||||
|
|
@ -179,7 +203,14 @@ if (! function_exists('bs_menu')) {
|
|||
// recurse
|
||||
$content .= '<ul class="treeview-menu">'.bs_menu_render($value['children']).'</ul>';
|
||||
} else {
|
||||
$content .= sprintf('<a href="%s"><i class="fa %s"></i> <span>%s</span></a>', url($value['link']), $value['icon'], trans($value['title']));
|
||||
if ($value) {
|
||||
$content .= sprintf(
|
||||
'<a href="%s"><i class="fa %s"></i> <span>%s</span></a>',
|
||||
url((string) $value['link']),
|
||||
(string) $value['icon'],
|
||||
trans((string) $value['title'])
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$content .= '</li>';
|
||||
|
|
|
|||
|
|
@ -8,23 +8,24 @@
|
|||
|
|
||||
*/
|
||||
|
||||
$menu['user'] = array(
|
||||
['title' => 'general.dashboard', 'link' => 'user', 'icon' => 'fa-dashboard'],
|
||||
['title' => 'general.my-closet', 'link' => 'user/closet', 'icon' => 'fa-star'],
|
||||
['title' => 'general.player-manage', 'link' => 'user/player', 'icon' => 'fa-users'],
|
||||
['title' => 'general.profile', 'link' => 'user/profile', 'icon' => 'fa-user'],
|
||||
);
|
||||
$menu['user'] = [
|
||||
['title' => 'general.dashboard', 'link' => 'user', 'icon' => 'fa-dashboard'],
|
||||
['title' => 'general.my-closet', 'link' => 'user/closet', 'icon' => 'fa-star'],
|
||||
['title' => 'general.player-manage', 'link' => 'user/player', 'icon' => 'fa-users'],
|
||||
['title' => 'general.profile', 'link' => 'user/profile', 'icon' => 'fa-user'],
|
||||
];
|
||||
|
||||
$menu['admin'] = array(
|
||||
['title' => 'general.dashboard', 'link' => 'admin', 'icon' => 'fa-dashboard'],
|
||||
['title' => 'general.user-manage', 'link' => 'admin/users', 'icon' => 'fa-users'],
|
||||
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
||||
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
|
||||
['title' => 'general.plugin-manage', 'link' => 'admin/plugins/manage', 'icon' => 'fa-plug'],
|
||||
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
||||
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
||||
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
||||
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
||||
);
|
||||
$menu['admin'] = [
|
||||
['title' => 'general.dashboard', 'link' => 'admin', 'icon' => 'fa-dashboard'],
|
||||
['title' => 'general.user-manage', 'link' => 'admin/users', 'icon' => 'fa-users'],
|
||||
['title' => 'general.player-manage', 'link' => 'admin/players', 'icon' => 'fa-gamepad'],
|
||||
['title' => 'general.customize', 'link' => 'admin/customize', 'icon' => 'fa-paint-brush'],
|
||||
['title' => 'general.score-options', 'link' => 'admin/score', 'icon' => 'fa-credit-card'],
|
||||
['title' => 'general.plugin-market', 'link' => 'admin/plugins/market', 'icon' => 'fa-shopping-bag'],
|
||||
['title' => 'general.plugin-manage', 'link' => 'admin/plugins/manage', 'icon' => 'fa-plug'],
|
||||
['title' => 'general.plugin-configs', 'id' => 'plugin-configs', 'icon' => 'fa-cogs', 'children' => []],
|
||||
['title' => 'general.options', 'link' => 'admin/options', 'icon' => 'fa-cog'],
|
||||
['title' => 'general.check-update', 'link' => 'admin/update', 'icon' => 'fa-arrow-up'],
|
||||
];
|
||||
|
||||
return $menu;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ player-manage: Players
|
|||
user-manage: Users
|
||||
plugin-manage: Plugins
|
||||
plugin-market: Plugin Market
|
||||
plugin-installed: Installed Plugins
|
||||
plugin-configs: Plugin Configs
|
||||
customize: Customize
|
||||
options: Options
|
||||
import-v2: Import Data
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ player-manage: 角色管理
|
|||
user-manage: 用户管理
|
||||
plugin-manage: 插件管理
|
||||
plugin-market: 插件市场
|
||||
plugin-installed: 已安装
|
||||
plugin-configs: 插件配置
|
||||
customize: 个性化
|
||||
options: 站点配置
|
||||
import-v2: 导入数据
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user