Move navigation entry to info.xml

Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Raimund Schlüßler 2019-09-23 13:42:38 +02:00
parent 9103930ae3
commit d82b353d4d
No known key found for this signature in database
GPG key ID: 036FA7EB1A599178
3 changed files with 9 additions and 47 deletions

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();

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>

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'),
];
});
}
}