blob: f9de886d821fa866bec3ca4067f232ec6e36fcca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
<?php
$id ??= "setting-$key";
$settingType = $type ?? 'text';
$inputType = $settingType;
if ($settingType == 'boolean') {
$inputType = 'checkbox';
$options = ['false', 'true'];
$checked = $value == 'true' || $value == true;
}
// php converts . to _ in $_POST for some mikuforsaken reason so i'm working around it like this
$fieldName ??= str_replace('.', '<DOT>', $key);
?>
<div class="row">
<label for="<?= $id ?>">
<strong><?= $name ?></strong><br>
<?= $description ?>
</label>
<?php if ($inputType == 'select'): ?>
<select id="<?= $id ?>" name="<?= $fieldName ?>" autocomplete="off">
<?php foreach ($options as $o): ?>
<option <?= $value == $o ? 'selected' : '' ?>><?= $o ?></option>
<?php endforeach; ?>
</select>
<?php elseif ($inputType == 'checkbox'): ?>
<input type="hidden" name="<?= $fieldName ?>" value="<?= $options[0] ?>">
<input id="<?= $id ?>" name="<?= $fieldName ?>" value="<?= $options[1] ?>" type="checkbox" <?= $checked ? 'checked' : '' ?> autocomplete="off">
<?php elseif ($inputType == 'longtext'): ?>
<textarea id="<?= $id ?>" name="<?= $fieldName ?>" autocomplete="off"><?= $value ?></textarea>
<?php else: ?>
<input id="<?= $id ?>" name="<?= $fieldName ?>" value="<?= $value ?>" type="<?= $inputType ?>" autocomplete="off">
<?php if ($inputType == 'timezone'): ?>
<button type="button" class="primary material-symbols update" title="<?= __('preferences.timezone.auto') ?>" _="
on click
js return Intl.DateTimeFormat().resolvedOptions().timeZone end
set the value of #<?= $id ?> to it
"></button>
<?php endif; ?>
<?php endif; ?>
</div>
|