diff options
author | Julius Haertl <jus@bitgrid.net> | 2017-01-11 12:34:49 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-03-16 11:55:09 +0100 |
commit | e3e4cb3e67fb4d1399b4a9cf229633144008fdcf (patch) | |
tree | 283afa406d0e6ebdcc501ccd3d6e2ca111f1acd0 /lib | |
parent | 42feab59d5ee45689c9ea6787b0aebceb777dab4 (diff) | |
download | nextcloud-server-e3e4cb3e67fb4d1399b4a9cf229633144008fdcf.tar.gz nextcloud-server-e3e4cb3e67fb4d1399b4a9cf229633144008fdcf.zip |
Move active app to the first slot
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/legacy/app.php | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index f89f32f069a..264e8f5fc60 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -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; } |