Move active app to the first slot

Signed-off-by: Julius Haertl <jus@bitgrid.net>
This commit is contained in:
Julius Haertl 2017-01-11 12:34:49 +01:00 committed by Julius Härtl
parent 42feab59d5
commit e3e4cb3e67
No known key found for this signature in database
GPG Key ID: 4C614C6ED2CDE6DF
1 changed files with 19 additions and 9 deletions

View File

@ -529,15 +529,7 @@ class OC_App {
// This is private as well. It simply works, so don't ask for more details
private static function proceedNavigation($list) {
$activeApp = OC::$server->getNavigationManager()->getActiveEntry();
foreach ($list as &$navEntry) {
if ($navEntry['id'] == $activeApp) {
$navEntry['active'] = true;
} else {
$navEntry['active'] = false;
}
}
unset($navEntry);
usort($list, function($a, $b) {
if (isset($a['order']) && isset($b['order'])) {
@ -549,6 +541,24 @@ class OC_App {
}
});
$activeApp = OC::$server->getNavigationManager()->getActiveEntry();
foreach ($list as $index => &$navEntry) {
if ($navEntry['id'] == $activeApp) {
$navEntry['active'] = true;
$activeAppIndex = $index;
} else {
$navEntry['active'] = false;
}
}
unset($navEntry);
// Move active app to the first position
if($activeAppIndex > 2) {
$active = $list[$activeAppIndex];
unset($list[$activeAppIndex]);
array_unshift($list, $active);
}
return $list;
}