v1.0.23 - green border working boot() + appinfo/app.php logs
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.22</version>
|
<version>1.0.23</version>
|
||||||
<licence>AGPL</licence>
|
<licence>AGPL</licence>
|
||||||
<author>Your Name</author>
|
<author>Your Name</author>
|
||||||
<namespace>MinimalProfile</namespace>
|
<namespace>MinimalProfile</namespace>
|
||||||
|
|||||||
@@ -1,18 +1,53 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Minimal Profile app bootstrap
|
declare(strict_types=1);
|
||||||
*/
|
|
||||||
namespace OCA\MinimalProfile\AppInfo;
|
namespace OCA\MinimalProfile\AppInfo;
|
||||||
|
|
||||||
use OCP\AppFramework\App;
|
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\IConfig;
|
||||||
use OCP\Util;
|
use OCP\Util;
|
||||||
|
|
||||||
class Application extends App implements IBootstrap {
|
class Application extends App implements IBootstrap {
|
||||||
public function register(IRegistrationContext $context): void {}
|
|
||||||
|
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 {
|
public function boot(IBootContext $context): void {
|
||||||
Util::addStyle('minimalprofile', 'minimalprofile');
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user