From 02825cee6759b5056d051fecc09103855584e741 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Tue, 3 Nov 2020 12:16:36 +0100 Subject: [PATCH] add option to hide apps (big menu display) --- lib/Controller/JsController.php | 1 + lib/Controller/NavController.php | 5 +++++ lib/Settings/Admin.php | 1 + templates/settings/admin-form.php | 36 +++++++++++++++++++++++++++++-- 4 files changed, 41 insertions(+), 2 deletions(-) diff --git a/lib/Controller/JsController.php b/lib/Controller/JsController.php index f868a05..b30e929 100644 --- a/lib/Controller/JsController.php +++ b/lib/Controller/JsController.php @@ -150,6 +150,7 @@ class JsController extends Controller 'loader-enabled' => $this->config->getAppValueBool('loader-enabled', '1'), 'always-displayed' => $this->config->getAppValueBool('always-displayed', '0'), 'big-menu' => $this->config->getAppValueBool('big-menu', '0'), + 'big-menu-hidden-apps' => $this->config->getAppValueArray('big-menu-hidden-apps', '[]'), 'avatar' => $avatar, 'top-menu-apps' => $topMenuApps, 'target-blank-apps' => $targetBlankApps, diff --git a/lib/Controller/NavController.php b/lib/Controller/NavController.php index d58d433..6c3751e 100644 --- a/lib/Controller/NavController.php +++ b/lib/Controller/NavController.php @@ -97,6 +97,7 @@ class NavController extends Controller $apps = $this->appRepository->getVisibleApps(); $currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2); $externalSitesInTopMenu = $this->config->getAppValueBool('external-sites-in-top-menu', '0'); + $hiddenApps = $this->config->getAppValueArray('big-menu-hidden-apps', '[]'); $user = OC::$server[IUserSession::class]->getUser(); $isForced = $this->config->getAppValueBool('force', '0'); $appsCategories = []; @@ -142,6 +143,10 @@ class NavController extends Controller continue; } + if (in_array($app['id'], $hiddenApps)) { + continue; + } + $categories = (array) $app['category']; $appsCategories[$app['id']] = []; diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index b7a6769..fdcfb43 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -77,6 +77,7 @@ class Admin implements ISettings 'opener' => $this->config->getAppValue('opener', 'side-menu-opener'), 'always-displayed' => $this->config->getAppValue('always-displayed', '0'), 'big-menu' => $this->config->getAppValue('big-menu', '0'), + 'big-menu-hidden-apps' => $this->config->getAppValueArray('big-menu-hidden-apps', '[]'), 'display-logo' => $this->config->getAppValue('display-logo', '1'), 'use-avatar' => $this->config->getAppValue('use-avatar', '0'), 'opener-position' => $this->config->getAppValue('opener-position', 'before'), diff --git a/templates/settings/admin-form.php b/templates/settings/admin-form.php index 3f84084..97d9d00 100644 --- a/templates/settings/admin-form.php +++ b/templates/settings/admin-form.php @@ -288,8 +288,6 @@ $choicesSizes = [ src="" alt="t('Big menu')); ?>">

-
-
+
+ +
+ +

t('This feature is only compatible with the big menu display.'); ?>

+ +

+ + 🖱️ t('Show and hide the list of applications')); ?> + +

+ + + +
+