Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-05-13 09:50:55 +0300
committerJoas Schilling <nickvergessen@owncloud.com>2015-05-13 09:54:25 +0300
commit658b603c3d8790146f9ca4b1699a1e6cf3bfb642 (patch)
treeaca60aa7b643c3c88800b6987679c371cab2944e /external
parentdcccf3e32f5a86e68367298ed03dfd44677fd362 (diff)
Do not create the navigation if the app is not enabled anymore
Diffstat (limited to 'external')
-rw-r--r--external/appinfo/app.php25
1 files changed, 15 insertions, 10 deletions
diff --git a/external/appinfo/app.php b/external/appinfo/app.php
index 4a157b843..b27fa4ef6 100644
--- a/external/appinfo/app.php
+++ b/external/appinfo/app.php
@@ -26,14 +26,19 @@ use OCA\External\External;
OCP\App::registerAdmin('external', 'settings');
$sites = External::getSites();
-for ($i = 0; $i < sizeof($sites); $i++) {
- OCP\App::addNavigationEntry(
- array(
- 'id' => 'external_index' . ($i + 1),
- 'order' => 80 + $i,
- 'href' => OCP\Util::linkToRoute('external_index', array('id'=> $i + 1)),
- 'icon' => OCP\Util::imagePath('external', !empty($sites[$i][2]) ? $sites[$i][2] : 'external.svg'),
- 'name' => $sites[$i][0]
- )
- );
+if (!empty($sites)) {
+ $urlGenerator = \OC::$server->getURLGenerator();
+ $navigationManager = \OC::$server->getNavigationManager();
+ for ($i = 0; $i < sizeof($sites); $i++) {
+ $navigationEntry = function () use ($i, $urlGenerator, $sites) {
+ return [
+ 'id' => 'external_index' . ($i + 1),
+ 'order' => 80 + $i,
+ 'href' => $urlGenerator->linkToRoute('external_index', ['id'=> $i + 1]),
+ 'icon' => $urlGenerator->imagePath('external', !empty($sites[$i][2]) ? $sites[$i][2] : 'external.svg'),
+ 'name' => $sites[$i][0],
+ ];
+ };
+ $navigationManager->add($navigationEntry);
+ }
}