diff options
author | Julius Härtl <jus@bitgrid.net> | 2020-09-23 09:43:36 +0300 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2020-09-24 21:00:23 +0300 |
commit | 8ab2422b6c34e5b0b6d1756cbadbb01899019456 (patch) | |
tree | 3cb29ff528a6d6f57c6f71724f2c25cccb1cc7bf /lib | |
parent | 54abcbc2aa188fc481e8ae03dd878262d3158023 (diff) |
Add acutal response to BeforeTemplateRenderedEvent
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php | 2 | ||||
-rw-r--r-- | lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php index 6c65ee8b2c6..28f322f42b7 100644 --- a/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php +++ b/lib/private/AppFramework/Middleware/AdditionalScriptsMiddleware.php @@ -71,7 +71,7 @@ class AdditionalScriptsMiddleware extends Middleware { $isLoggedIn = false; } - $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn)); + $this->dispatcher->dispatchTyped(new BeforeTemplateRenderedEvent($isLoggedIn, $response)); } return $response; diff --git a/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php b/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php index 3d48e9a269d..b96b86abd57 100644 --- a/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php +++ b/lib/public/AppFramework/Http/Events/BeforeTemplateRenderedEvent.php @@ -27,6 +27,7 @@ declare(strict_types=1); namespace OCP\AppFramework\Http\Events; +use OCP\AppFramework\Http\TemplateResponse; use OCP\EventDispatcher\Event; /** @@ -38,14 +39,17 @@ use OCP\EventDispatcher\Event; class BeforeTemplateRenderedEvent extends Event { /** @var bool */ private $loggedIn; + /** @var TemplateResponse */ + private $response; /** * @since 20.0.0 */ - public function __construct(bool $loggedIn) { + public function __construct(bool $loggedIn, TemplateResponse $response) { parent::__construct(); $this->loggedIn = $loggedIn; + $this->response = $response; } /** @@ -54,4 +58,11 @@ class BeforeTemplateRenderedEvent extends Event { public function isLoggedIn(): bool { return $this->loggedIn; } + + /** + * @since 20.0.0 + */ + public function getResponse(): TemplateResponse { + return $this->response; + } } |