Clean up
This commit is contained in:
@@ -1,49 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace OCA\MinimalProfile\Service;
|
|
||||||
|
|
||||||
class Config {
|
|
||||||
|
|
||||||
private $config;
|
|
||||||
|
|
||||||
public function __construct($config) {
|
|
||||||
$this->config = $config;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getHiddenFields(): array {
|
|
||||||
$value = $this->config->getAppValue('minimalprofile', 'hidden_fields', '');
|
|
||||||
if ($value === '') {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
return json_decode($value, true) ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generateCss(array $fields): string {
|
|
||||||
$selectors = [
|
|
||||||
'pronouns' => '#account-property-pronouns',
|
|
||||||
'role' => '#account-property-role',
|
|
||||||
'headline' => '#account-property-headline',
|
|
||||||
'biography' => '#account-property-biography',
|
|
||||||
'organisation' => '#account-property-organisation',
|
|
||||||
'phone' => '#account-property-phone',
|
|
||||||
'address' => '#account-property-address',
|
|
||||||
'birthdate' => '#account-property-birthdate',
|
|
||||||
'website' => '#account-property-website',
|
|
||||||
'twitter' => '#account-property-twitter',
|
|
||||||
'fediverse' => '#account-property-fediverse',
|
|
||||||
'location' => '#account-property-location',
|
|
||||||
];
|
|
||||||
|
|
||||||
$css = '';
|
|
||||||
foreach ($fields as $field) {
|
|
||||||
if (isset($selectors[$field])) {
|
|
||||||
$selector = $selectors[$field];
|
|
||||||
$css .= $selector . ' { display: none !important; }' . "\n";
|
|
||||||
$css .= '.personal-settings-setting-box:has(' . $selector . ') { display: none !important; }' . "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $css;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user