Load CSS via PHP event listener
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user