forked from deblan/side_menu
fix compatibility with the option 'hide-when-no-apps'
This commit is contained in:
parent
ffab77aff2
commit
9d9afff08d
3 changed files with 18 additions and 3 deletions
|
|
@ -27,6 +27,8 @@ use OCP\IL10N;
|
|||
use OCP\IRequest;
|
||||
use OCP\L10N\IFactory;
|
||||
use OC\URLGenerator;
|
||||
use OC;
|
||||
use OCP\IUserSession;
|
||||
|
||||
class NavController extends Controller
|
||||
{
|
||||
|
|
@ -96,10 +98,17 @@ class NavController extends Controller
|
|||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||
$categoriesLabels = $this->categoryFetcher->get();
|
||||
$externalSitesInTopMenu = (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0);
|
||||
$user = OC::$server[IUserSession::class]->getUser();
|
||||
$appsCategories = [];
|
||||
$categoriesAppsCount = [];
|
||||
$items = [];
|
||||
|
||||
if (!$user) {
|
||||
return new JSONResponse([
|
||||
'items' => $items,
|
||||
]);
|
||||
}
|
||||
|
||||
foreach ($categoriesLabels as $k => $category) {
|
||||
$categoriesLabels[$category['id']] = $category['translations'][$currentLanguage]['name'] ?? $category['translations']['en']['name'];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue