diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-08-04 18:15:09 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-08-05 11:37:45 +0200 |
commit | d98f7c1bd83fc03fd297ebeac6279ffe17316950 (patch) | |
tree | 4f1f261e1033f441a0deaa30f5aeb56cbbb51c43 /lib | |
parent | 71b62c4203a25beefeab73f73668919c813e3a50 (diff) | |
download | nextcloud-server-d98f7c1bd83fc03fd297ebeac6279ffe17316950.tar.gz nextcloud-server-d98f7c1bd83fc03fd297ebeac6279ffe17316950.zip |
Make apps handle the order logic
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Search/SearchComposer.php | 8 | ||||
-rw-r--r-- | lib/public/Search/IProvider.php | 4 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php index 7ba6296c9de..f86626909c4 100644 --- a/lib/private/Search/SearchComposer.php +++ b/lib/private/Search/SearchComposer.php @@ -109,17 +109,19 @@ class SearchComposer { * Get a list of all provider IDs & Names for the consecutive calls to `search` * Sort the list by the order property * + * @param string $from the url the user is currently at + * * @return array */ - public function getProviders(): array { + public function getProviders(string $from): array { $this->loadLazyProviders(); $providers = array_values( - array_map(function (IProvider $provider) { + array_map(function (IProvider $provider) use ($from) { return [ 'id' => $provider->getId(), 'name' => $provider->getName(), - 'order' => $provider->getOrder() + 'order' => $provider->getOrder($from) ]; }, $this->providers) ); diff --git a/lib/public/Search/IProvider.php b/lib/public/Search/IProvider.php index 66db62c6829..5a6cfb3fd03 100644 --- a/lib/public/Search/IProvider.php +++ b/lib/public/Search/IProvider.php @@ -68,11 +68,13 @@ interface IProvider { * Get the search provider order * The lower the int, the higher it will be sorted (0 will be before 10) * + * @param string $from the url the user is currently at. (e.g. /apps/files/?dir=/&fileid=982) + * * @return int * * @since 20.0.0 */ - public function getOrder(): int; + public function getOrder(string $from): int; /** * Find matching search entries in an app |