Language selector added, "channel" is now "channels"

This commit is contained in:
Michael 2023-09-03 12:54:25 +00:00
parent 140ac947b5
commit 8b26d488ad
9 changed files with 128 additions and 92 deletions

View file

@ -76,6 +76,7 @@ class Display extends BaseSettings
$theme = !empty($request['theme']) ? trim($request['theme']) : $user['theme'];
$mobile_theme = !empty($request['mobile_theme']) ? trim($request['mobile_theme']) : '';
$enable_smile = !empty($request['enable_smile']) ? intval($request['enable_smile']) : 0;
$channel_languages = !empty($request['channel_languages']) ? $request['channel_languages'] : [];
$first_day_of_week = !empty($request['first_day_of_week']) ? intval($request['first_day_of_week']) : 0;
$calendar_default_view = !empty($request['calendar_default_view']) ? trim($request['calendar_default_view']) : 'month';
$infinite_scroll = !empty($request['infinite_scroll']) ? intval($request['infinite_scroll']) : 0;
@ -120,8 +121,10 @@ class Display extends BaseSettings
$this->pConfig->set($uid, 'system', 'stay_local' , $stay_local);
$this->pConfig->set($uid, 'system', 'preview_mode' , $preview_mode);
$this->pConfig->set($uid, 'channel', 'languages' , $channel_languages);
$this->pConfig->set($uid, 'calendar', 'first_day_of_week' , $first_day_of_week);
$this->pConfig->set($uid, 'calendar', 'default_view' , $calendar_default_view);
$this->pConfig->set($uid, 'calendar', 'default_view' , $calendar_default_view);
if (in_array($theme, Theme::getAllowedList())) {
if ($theme == $user['theme']) {
@ -215,6 +218,8 @@ class Display extends BaseSettings
BBCode::PREVIEW_LARGE => $this->t('Large Image'),
];
$channel_languages = $this->pConfig->get($uid, 'channel', 'languages', [User::getLanguageCode($uid, false)]);
$languages = $this->l10n->getAvailableLanguages();
$first_day_of_week = $this->pConfig->get($uid, 'calendar', 'first_day_of_week', 0);
$weekdays = [
@ -249,6 +254,7 @@ class Display extends BaseSettings
'$d_ctset' => $this->t('Custom Theme Settings'),
'$d_cset' => $this->t('Content Settings'),
'$stitle' => $this->t('Theme settings'),
'$channel_title' => $this->t('Channels'),
'$calendar_title' => $this->t('Calendar'),
'$form_security_token' => self::getFormSecurityToken('settings_display'),
@ -269,6 +275,8 @@ class Display extends BaseSettings
'$stay_local' => ['stay_local' , $this->t('Stay local'), $stay_local, $this->t("Don't go to a remote system when following a contact link.")],
'$preview_mode' => ['preview_mode' , $this->t('Link preview mode'), $preview_mode, $this->t('Appearance of the link preview that is added to each post with a link.'), $preview_modes, false],
'$channel_languages' => ['channel_languages[]', $this->t('Channel languages:'), $channel_languages, $this->t('Select all languages that you want to see in your channels.'), $languages, 'multiple'],
'$first_day_of_week' => ['first_day_of_week' , $this->t('Beginning of week:') , $first_day_of_week , '', $weekdays , false],
'$calendar_default_view' => ['calendar_default_view', $this->t('Default calendar view:'), $calendar_default_view, '', $calendarViews, false],
]);