forked from deblan/side_menu
use custom app names using 'app.navigation.name' (fix #148)
This commit is contained in:
parent
f20dc7282e
commit
6533acdd60
|
@ -36,8 +36,7 @@ class AppRepository
|
|||
IFactory $l10nFactory,
|
||||
ConfigProxy $config,
|
||||
CategoryRepository $categoryRepository
|
||||
)
|
||||
{
|
||||
) {
|
||||
$this->ocApp = $ocApp;
|
||||
$this->l10nFactory = $l10nFactory;
|
||||
$this->config = $config;
|
||||
|
@ -62,7 +61,7 @@ class AppRepository
|
|||
|
||||
foreach ([$app['id'], $app['id'].'_index'] as $id) {
|
||||
if (isset($navigation[$id])) {
|
||||
$app['name'] = $this->l10nFactory->get($id)->t($app['name']);
|
||||
$app['name'] = $this->getAppName($app);
|
||||
$app['href'] = $navigation[$id]['href'];
|
||||
$app['icon'] = $navigation[$id]['icon'];
|
||||
|
||||
|
@ -75,7 +74,7 @@ class AppRepository
|
|||
if ('external_index' === substr($app['id'], 0, 14)) {
|
||||
$visibleApps[$app['id']] = [
|
||||
'id' => $app['id'],
|
||||
'name' => $this->l10nFactory->get($app['id'])->t($app['name']),
|
||||
'name' => $this->getAppName($app),
|
||||
'href' => $app['href'],
|
||||
'icon' => $app['icon'],
|
||||
'category' => [
|
||||
|
@ -85,7 +84,7 @@ class AppRepository
|
|||
} elseif ('files' === $app['id']) {
|
||||
$visibleApps[$app['id']] = [
|
||||
'id' => $app['id'],
|
||||
'name' => $this->l10nFactory->get($app['id'])->t($app['name']),
|
||||
'name' => $this->getAppName($app),
|
||||
'href' => $app['href'],
|
||||
'icon' => $app['icon'],
|
||||
'category' => [],
|
||||
|
@ -106,6 +105,15 @@ class AppRepository
|
|||
return $visibleApps;
|
||||
}
|
||||
|
||||
public function getAppName($app)
|
||||
{
|
||||
return $this->config->getAppValue(
|
||||
'app.navigation.name',
|
||||
$this->l10nFactory->get($app['id'])->t($app['name']),
|
||||
$app['id']
|
||||
);
|
||||
}
|
||||
|
||||
public function getTopMenuOrderedApps()
|
||||
{
|
||||
$apps = $this->getVisibleApps();
|
||||
|
@ -115,7 +123,7 @@ class AppRepository
|
|||
$ak = array_keys($orders, $a['id'])[0] ?? null;
|
||||
$bk = array_keys($orders, $b['id'])[0] ?? null;
|
||||
|
||||
if ($ak === null || $bk === null) {
|
||||
if (null === $ak || null === $bk) {
|
||||
return ($a['name'] < $b['name']) ? -1 : 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue