Browse Source

Move navigation entry to info.xml

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
pull/632/head
Raimund Schlüßler 1 month ago
parent
commit
d82b353d4d
No account linked to committer's email address
3 changed files with 9 additions and 47 deletions
  1. 0
    24
      appinfo/app.php
  2. 9
    0
      appinfo/info.xml
  3. 0
    23
      lib/AppInfo/Application.php

+ 0
- 24
appinfo/app.php View File

@@ -1,24 +0,0 @@
<?php
/**
* Nextcloud - Tasks
*
* @author Raimund Schlüßler
* @copyright 2018 Raimund Schlüßler <raimund.schluessler@mailbox.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
* License as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
*
* You should have received a copy of the GNU Affero General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/

$app = new \OCA\Tasks\AppInfo\Application();
$app->registerNavigation();

+ 9
- 0
appinfo/info.xml View File

@@ -22,4 +22,13 @@
<dependencies>
<nextcloud min-version="15" max-version="18"/>
</dependencies>
<navigations>
<navigation>
<id>tasks</id>
<name>Tasks</name>
<route>tasks.page.index</route>
<icon>tasks.svg</icon>
<order>100</order>
</navigation>
</navigations>
</info>

+ 0
- 23
lib/AppInfo/Application.php View File

@@ -32,27 +32,4 @@ class Application extends App {
public function __construct(array $params=[]) {
parent::__construct('tasks', $params);
}

/**
* Register navigation
*/
public function registerNavigation() {
$appName = $this->getContainer()->getAppName();
$server = $this->getContainer()->getServer();
$urlGenerator = $server->getURLGenerator();

$server->getNavigationManager()->add(function() use ($appName, $server, $urlGenerator) {
return [
'id' => $appName,

'order' => 100,

'href' => $urlGenerator->linkToRoute('tasks.page.index'),

'icon' => $urlGenerator->imagePath($appName, 'tasks.svg'),

'name' => $server->getL10N($appName)->t('Tasks'),
];
});
}
}

Loading…
Cancel
Save