Files
nextcloud_minimalprofile/lib/AppInfo/Application.php

53 lines
1.3 KiB
PHP
Raw Normal View History

<?php
declare(strict_types=1);
namespace OCA\MinimalProfile\AppInfo;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\IConfig;
use OCP\Util;
class Application extends App implements IBootstrap {
public const APP_ID = 'minimalprofile';
public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
}
public function register(IRegistrationContext $context): void {
}
public function boot(IBootContext $context): void {
$container = $context->getAppContainer();
$config = $container->query(IConfig::class);
$value = $config->getAppValue('minimalprofile', 'hidden_fields', '');
$hidden = ($value !== '') ? json_decode($value, true) ?? [] : [];
$css = '';
if (!empty($hidden)) {
$selectors = [
'pronouns' => '#account-property-pronouns',
'role' => '#account-property-role',
'headline' => '#account-property-headline',
];
foreach ($hidden as $field) {
if (isset($selectors[$field])) {
$css .= $selectors[$field] . ' { display: none !important; }' . "\n";
}
}
} else {
// Debug
$css = 'body { border: 30px solid green !important; }';
}
if ($css) {
Util::addInlineStyle('minimalprofile', $css);
}
2026-04-16 14:50:02 +02:00
}
}