summaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2020-07-13 22:29:14 +0200
committerMorris Jobke <hey@morrisjobke.de>2020-07-15 14:07:18 +0200
commit7d7ba61625b21984eb01db895081d964a73ea934 (patch)
tree0e4fc65db04eb93be5971ed70dbad6d210d81ce3 /lib/public/AppFramework
parentda4f3559c5f1ab5db77e2cb06c2d618fb228313b (diff)
downloadnextcloud-server-7d7ba61625b21984eb01db895081d964a73ea934.tar.gz
nextcloud-server-7d7ba61625b21984eb01db895081d964a73ea934.zip
Add real events to load additionalscripts
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public/AppFramework')
-rw-r--r--lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php56
-rw-r--r--lib/public/AppFramework/Http/TemplateResponse.php6
2 files changed, 62 insertions, 0 deletions
diff --git a/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php b/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php
new file mode 100644
index 00000000000..1af679f91d4
--- /dev/null
+++ b/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php
@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ * @author Morris Jobke <hey@morrisjobke.de>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * 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
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace OCP\AppFramework\Http\Events;
+
+use OCP\EventDispatcher\Event;
+
+/**
+ * The event is triggered before the rendering step of each TemplateResponse.
+ *
+ * @package OCP\AppFramework\Http\Events
+ * @since 20.0.0
+ */
+class BeforeTemplateRenderedEvent extends Event {
+ /** @var bool */
+ private $loggedIn;
+
+ /**
+ * @since 20.0.0
+ */
+ public function __construct(bool $loggedIn) {
+ parent::__construct();
+
+ $this->loggedIn = $loggedIn;
+ }
+
+ /**
+ * @since 20.0.0
+ */
+ public function isLoggedIn(): bool {
+ return $this->loggedIn;
+ }
+}
diff --git a/lib/public/AppFramework/Http/TemplateResponse.php b/lib/public/AppFramework/Http/TemplateResponse.php
index bc86c153b75..48e6c43411f 100644
--- a/lib/public/AppFramework/Http/TemplateResponse.php
+++ b/lib/public/AppFramework/Http/TemplateResponse.php
@@ -38,7 +38,13 @@ namespace OCP\AppFramework\Http;
* @since 6.0.0
*/
class TemplateResponse extends Response {
+ /**
+ * @deprecated 20.0.0 use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
+ */
public const EVENT_LOAD_ADDITIONAL_SCRIPTS = self::class . '::loadAdditionalScripts';
+ /**
+ * @deprecated 20.0.0 use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent
+ */
public const EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN = self::class . '::loadAdditionalScriptsLoggedIn';
/**