diff options
Diffstat (limited to 'templates/preferences_form.php')
| -rw-r--r-- | templates/preferences_form.php | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/templates/preferences_form.php b/templates/preferences_form.php index 8c8f203..33418f6 100644 --- a/templates/preferences_form.php +++ b/templates/preferences_form.php @@ -2,27 +2,26 @@ use Digitigrade\UserSettings; $settings = new UserSettings($user); + +function _user_pref(string $id, mixed $value, string $type) { + call_template('settings_field', [ + 'id' => "pref-$id", + 'fieldName' => $id, + 'name' => __("preferences.$id.name"), + 'description' => __("preferences.$id.description"), + 'value' => $value, + 'type' => $type + ]); +} + ?> <form class="settings" method="post" action="/todo" hx-post="/fragment/preferences" hx-disabled-elt="find button" hx-swap="outerHTML"> <?php - call_template('settings_field', [ - 'id' => 'pref-requestToFollow', - 'fieldName' => 'requestToFollow', - 'name' => __('preferences.requestToFollow.name'), - 'description' => __('preferences.requestToFollow.description'), - 'value' => $user->actor->requestToFollow, - 'type' => 'boolean' - ]); - call_template('settings_field', [ - 'id' => 'pref-smallIndicators', - 'fieldName' => 'smallIndicators', - 'name' => __('preferences.smallIndicators.name'), - 'description' => __('preferences.smallIndicators.description'), - 'value' => $settings->getBool('interface.smallUnreadIndicators'), - 'type' => 'boolean' - ]); + _user_pref('requestToFollow', $user->actor->requestToFollow, 'boolean'); + _user_pref('smallIndicators', $settings->getBool('interface.smallUnreadIndicators'), 'boolean'); + _user_pref('timezone', $settings->get('locale.timezone'), 'timezone'); ?> <div class="row"> |
