From 93fa190e5e59d6d2c446b9c63ece41bebf285364 Mon Sep 17 00:00:00 2001 From: Guy Van Sanden Date: Thu, 16 Apr 2026 14:34:08 +0200 Subject: [PATCH] Load CSS via PHP event listener --- appinfo/info.xml | 3 +-- lib/AppInfo/Application.php | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/appinfo/info.xml b/appinfo/info.xml index 3065e65..9cb0b05 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -4,7 +4,7 @@ Minimal Profile Hides profile fields to create a minimal user profile Allows administrators to hide profile fields like pronouns, social links, etc. - 1.0.9 + 1.0.10 AGPL Your Name MinimalProfile @@ -14,5 +14,4 @@ - minimalprofile \ No newline at end of file diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 7c7d987..e814eff 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -8,6 +8,9 @@ use OCP\AppFramework\App; use OCP\AppFramework\Bootstrap\IBootContext; use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; +use OCP\AppFramework\Http\TemplateResponse; +use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventListener; class Application extends App implements IBootstrap { @@ -18,6 +21,14 @@ class Application extends App implements IBootstrap { } public function register(IRegistrationContext $context): void { + $context->registerEventListener( + TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS, + function(Event $event) { + if ($event instanceof TemplateResponse) { + $event->getStyleSheet()->load('minimalprofile', 'minimalprofile'); + } + } + ); } public function boot(IBootContext $context): void {