]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add an event so apps can add hidden fields to the files page
authorJoas Schilling <coding@schilljs.com>
Mon, 12 Jun 2017 07:57:34 +0000 (09:57 +0200)
committerMorris Jobke <hey@morrisjobke.de>
Tue, 13 Jun 2017 17:28:03 +0000 (12:28 -0500)
Signed-off-by: Joas Schilling <coding@schilljs.com>
apps/files/lib/Controller/ViewController.php
apps/files/templates/index.php

index fc59622af895a943692fa48bd7239e4a8e27352e..bfeb2cafcf6d4c1daebc3e10c1d7b26e79c63604 100644 (file)
@@ -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,
index 1670ccfd138e24ccf3d55a19ccfe8a3f1280098a..b49684643bb523e89a30dcac7c1d360977ea4c49 100644 (file)
@@ -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 }