Add debug blue border in boot method
This commit is contained in:
@@ -9,8 +9,6 @@ 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\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
@@ -25,25 +23,23 @@ class Application extends App implements IBootstrap {
|
|||||||
$context->registerService(Config::class, function($c) {
|
$context->registerService(Config::class, function($c) {
|
||||||
return new Config($c->get(\OCP\IConfig::class));
|
return new Config($c->get(\OCP\IConfig::class));
|
||||||
});
|
});
|
||||||
|
|
||||||
$context->registerEventListener(
|
|
||||||
TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS,
|
|
||||||
function(Event $event) {
|
|
||||||
if (!($event instanceof TemplateResponse)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$container = $event->getAppContainer();
|
|
||||||
$config = $container->query(Config::class);
|
|
||||||
$hidden = $config->getHiddenFields();
|
|
||||||
|
|
||||||
if (!empty($hidden)) {
|
|
||||||
$css = $config->generateCss($hidden);
|
|
||||||
Util::addInlineStyle($css);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function boot(IBootContext $context): void {
|
public function boot(IBootContext $context): void {
|
||||||
|
$container = $context->getAppContainer();
|
||||||
|
$config = $container->query(Config::class);
|
||||||
|
$hidden = $config->getHiddenFields();
|
||||||
|
|
||||||
|
$css = '';
|
||||||
|
if (!empty($hidden)) {
|
||||||
|
$css = $config->generateCss($hidden);
|
||||||
|
} else {
|
||||||
|
// Debug - always show something
|
||||||
|
$css = 'body { border: 20px solid blue !important; }';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($css) {
|
||||||
|
Util::addInlineStyle('minimalprofile', $css);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user