aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/INavigationManager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/INavigationManager.php')
-rw-r--r--lib/public/INavigationManager.php76
1 files changed, 48 insertions, 28 deletions
diff --git a/lib/public/INavigationManager.php b/lib/public/INavigationManager.php
index 710cbd1248d..2bd70c04d65 100644
--- a/lib/public/INavigationManager.php
+++ b/lib/public/INavigationManager.php
@@ -1,40 +1,20 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bart Visscher <bartv@thisnet.nl>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Joas Schilling <coding@schilljs.com>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Jörn Friedrich Dreyer <jfd@butonic.de>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program 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, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
+// This means that they should be used by apps instead of the internal Nextcloud classes
namespace OCP;
/**
* Manages the ownCloud navigation
* @since 6.0.0
+ *
+ * @psalm-type NavigationEntry = array{id: string, order: int, href: string, name: string, app?: string, icon?: string, classes?: string, type?: string}
*/
interface INavigationManager {
/**
@@ -58,9 +38,11 @@ interface INavigationManager {
/**
* Creates a new navigation entry
*
- * @param array|\Closure $entry Array containing: id, name, order, icon and href key
+ * @param array array|\Closure $entry Array containing: id, name, order, icon and href key
+ * If a menu entry (type = 'link') is added, you shall also set app to the app that added the entry.
* The use of a closure is preferred, because it will avoid
* loading the routing of your app, unless required.
+ * @psalm-param NavigationEntry|callable():NavigationEntry $entry
* @return void
* @since 6.0.0
*/
@@ -98,4 +80,42 @@ interface INavigationManager {
* @since 22.0.0
*/
public function setUnreadCounter(string $id, int $unreadCounter): void;
+
+ /**
+ * Get a navigation entry by id.
+ *
+ * @param string $id ID of the navigation entry
+ * @since 31.0.0
+ */
+ public function get(string $id): ?array;
+
+ /**
+ * Returns the id of the user's default entry
+ *
+ * If `user` is not passed, the currently logged in user will be used
+ *
+ * @param ?IUser $user User to query default entry for
+ * @param bool $withFallbacks Include fallback values if no default entry was configured manually
+ * Before falling back to predefined default entries,
+ * the user defined entry order is considered and the first entry would be used as the fallback.
+ * @since 31.0.0
+ */
+ public function getDefaultEntryIdForUser(?IUser $user = null, bool $withFallbacks = true): string;
+
+ /**
+ * Get the global default entries with fallbacks
+ *
+ * @return string[] The default entries
+ * @since 31.0.0
+ */
+ public function getDefaultEntryIds(): array;
+
+ /**
+ * Set the global default entries with fallbacks
+ *
+ * @param string[] $ids
+ * @throws \InvalidArgumentException If any of the entries is not available
+ * @since 31.0.0
+ */
+ public function setDefaultEntryIds(array $ids): void;
}