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