add custom apps sorting
This commit is contained in:
@@ -105,4 +105,23 @@ class AppRepository
|
||||
|
||||
return $visibleApps;
|
||||
}
|
||||
|
||||
public function getTopMenuOrderedApps()
|
||||
{
|
||||
$apps = $this->getVisibleApps();
|
||||
$orders = $this->config->getAppValueArray('top-menu-apps-order', '[]');
|
||||
|
||||
usort($apps, function ($a, $b) use ($orders) {
|
||||
$ak = array_keys($orders, $a['id'])[0] ?? null;
|
||||
$bk = array_keys($orders, $b['id'])[0] ?? null;
|
||||
|
||||
if ($ak === null || $bk === null) {
|
||||
return ($a['name'] < $b['name']) ? -1 : 1;
|
||||
}
|
||||
|
||||
return $ak < $bk ? -1 : 1;
|
||||
});
|
||||
|
||||
return $apps;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user