add add top-menu-apps option in the personal settings

This commit is contained in:
Simon Vieille
2020-08-12 15:59:51 +02:00
parent 9d9afff08d
commit a1b1396b63
6 changed files with 91 additions and 7 deletions
+11 -3
View File
@@ -109,6 +109,13 @@ class NavController extends Controller
]);
}
$topMenuApps = (array) json_decode($this->config->getAppValue('side_menu', 'top-menu-apps', '[]'), true);
$userTopMenuApps = (array) json_decode($this->config->getUserValue($user->getUid(), 'side_menu', 'top-menu-apps', '[]'), true);
if (!empty($userTopMenuApps)) {
$topMenuApps = $userTopMenuApps;
}
foreach ($categoriesLabels as $k => $category) {
$categoriesLabels[$category['id']] = $category['translations'][$currentLanguage]['name'] ?? $category['translations']['en']['name'];
@@ -118,13 +125,14 @@ class NavController extends Controller
$categoriesLabels['external_links'] = $this->trans->t('External sites');
foreach ($apps as $app) {
if (in_array($app['id'], $topMenuApps)) {
continue;
}
$categories = (array) $app['category'];
$appsCategories[$app['id']] = [];
foreach ($categories as $category) {
if ($externalSitesInTopMenu && $category === 'external_links') {
continue;
}
if (!isset($items[$category])) {
$items[$category] = [