Load CSS via PHP event listener
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<name>Minimal Profile</name>
|
<name>Minimal Profile</name>
|
||||||
<summary>Hides profile fields to create a minimal user profile</summary>
|
<summary>Hides profile fields to create a minimal user profile</summary>
|
||||||
<description>Allows administrators to hide profile fields like pronouns, social links, etc.</description>
|
<description>Allows administrators to hide profile fields like pronouns, social links, etc.</description>
|
||||||
<version>1.0.9</version>
|
<version>1.0.10</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Your Name</author>
|
<author>Your Name</author>
|
||||||
<namespace>MinimalProfile</namespace>
|
<namespace>MinimalProfile</namespace>
|
||||||
@@ -14,5 +14,4 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
<nextcloud min-version="33" max-version="33"/>
|
<nextcloud min-version="33" max-version="33"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<css>minimalprofile</css>
|
|
||||||
</info>
|
</info>
|
||||||
@@ -8,6 +8,9 @@ use OCP\AppFramework\App;
|
|||||||
use OCP\AppFramework\Bootstrap\IBootContext;
|
use OCP\AppFramework\Bootstrap\IBootContext;
|
||||||
use OCP\AppFramework\Bootstrap\IBootstrap;
|
use OCP\AppFramework\Bootstrap\IBootstrap;
|
||||||
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
use OCP\AppFramework\Bootstrap\IRegistrationContext;
|
||||||
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\EventDispatcher\Event;
|
||||||
|
use OCP\EventDispatcher\IEventListener;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
|
|
||||||
@@ -18,6 +21,14 @@ class Application extends App implements IBootstrap {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function register(IRegistrationContext $context): void {
|
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 {
|
public function boot(IBootContext $context): void {
|
||||||
|
|||||||
Reference in New Issue
Block a user