Load CSS via PHP event listener

This commit is contained in:
2026-04-16 14:34:08 +02:00
parent 5ff45286af
commit 93fa190e5e
2 changed files with 12 additions and 2 deletions

View File

@@ -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 {