summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-06-12 09:57:34 +0200
committerLukas Reschke <lukas@statuscode.ch>2017-06-13 11:17:44 +0200
commitfcdcd3f2832bffcc9f2a28cf485f9859ce2e5227 (patch)
tree77d5c18d9bf3d494d1eab3dd58f2c12afb98dfb7
parentb0171a758452176317e30e5431ac2833d06bffc3 (diff)
downloadnextcloud-server-fcdcd3f2832bffcc9f2a28cf485f9859ce2e5227.tar.gz
nextcloud-server-fcdcd3f2832bffcc9f2a28cf485f9859ce2e5227.zip
Add an event so apps can add hidden fields to the files page
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/files/lib/Controller/ViewController.php5
-rw-r--r--apps/files/templates/index.php4
2 files changed, 8 insertions, 1 deletions
diff --git a/apps/files/lib/Controller/ViewController.php b/apps/files/lib/Controller/ViewController.php
index fc59622af89..bfeb2cafcf6 100644
--- a/apps/files/lib/Controller/ViewController.php
+++ b/apps/files/lib/Controller/ViewController.php
@@ -41,6 +41,7 @@ use OCP\IUserSession;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use OCP\Files\Folder;
use OCP\App\IAppManager;
+use Symfony\Component\EventDispatcher\GenericEvent;
/**
* Class ViewController
@@ -199,7 +200,8 @@ class ViewController extends Controller {
$contentItems[] = $contentItem;
}
- $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts');
+ $event = new GenericEvent(null, ['hiddenFields' => []]);
+ $this->eventDispatcher->dispatch('OCA\Files::loadAdditionalScripts', $event);
$params = [];
$params['usedSpacePercent'] = (int)$storageInfo['relative'];
@@ -215,6 +217,7 @@ class ViewController extends Controller {
$params['fileNotFound'] = $fileNotFound ? 1 : 0;
$params['appNavigation'] = $nav;
$params['appContents'] = $contentItems;
+ $params['hiddenFields'] = $event->getArgument('hiddenFields');
$response = new TemplateResponse(
$this->appName,
diff --git a/apps/files/templates/index.php b/apps/files/templates/index.php
index 1670ccfd138..b49684643bb 100644
--- a/apps/files/templates/index.php
+++ b/apps/files/templates/index.php
@@ -21,3 +21,7 @@
<input type="hidden" name="defaultFileSortingDirection" id="defaultFileSortingDirection" value="<?php p($_['defaultFileSortingDirection']) ?>" />
<input type="hidden" name="showHiddenFiles" id="showHiddenFiles" value="<?php p($_['showHiddenFiles']); ?>" />
<?php endif;
+
+foreach ($_['hiddenFields'] as $name => $value) {?>
+<input type="hidden" name="<?php p($name) ?>" id="<?php p($name) ?>" value="<?php p($value) ?>" />
+<?php }