forked from deblan/side_menu
add external links
This commit is contained in:
parent
8aa08dbc6b
commit
caa9c092ef
4 changed files with 23 additions and 3 deletions
|
|
@ -31,7 +31,7 @@ use OC\URLGenerator;
|
|||
class NavController extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \OCP\IConfig
|
||||
* @var IConfig
|
||||
*/
|
||||
protected $config;
|
||||
|
||||
|
|
@ -95,6 +95,7 @@ class NavController extends Controller
|
|||
$apps = $this->appRepository->getVisibleApps();
|
||||
$currentLanguage = substr($this->l10nFactory->findLanguage(), 0, 2);
|
||||
$categoriesLabels = $this->categoryFetcher->get();
|
||||
$externalSitesInTopMenu = (bool) $this->config->getAppValue('side_menu', 'external-sites-in-top-menu', 0);
|
||||
$appsCategories = [];
|
||||
$categoriesAppsCount = [];
|
||||
$items = [];
|
||||
|
|
@ -105,11 +106,17 @@ class NavController extends Controller
|
|||
unset($categoriesLabels[$k]);
|
||||
}
|
||||
|
||||
$categoriesLabels['external_links'] = $this->trans->t('External sites');
|
||||
|
||||
foreach ($apps as $app) {
|
||||
$categories = (array) $app['category'];
|
||||
$appsCategories[$app['id']] = [];
|
||||
|
||||
foreach ($categories as $category) {
|
||||
if ($externalSitesInTopMenu && $category === 'external_links') {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($items[$category])) {
|
||||
$items[$category] = [
|
||||
'name' => $categoriesLabels[$category],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue