N°3632 Move tab's layout preference to preferences page

This commit is contained in:
Stephen Abello
2021-01-22 10:29:17 +01:00
parent b3f1b0e610
commit 46b4990252
5 changed files with 21 additions and 20 deletions

View File

@@ -331,7 +331,15 @@ JS
$oTabsForm = new Form();
$oTabsForm->AddSubBlock(InputUIBlockFactory::MakeForHidden('operation', 'apply_tab_config'));
// Tab Layout
$sTabsLayoutValue = appUserPreferences::GetPref('tab_layout', false);;
$oTabsLayout = InputUIBlockFactory::MakeForSelectWithLabel('tab_layout', Dict::S('UI:Tabs:Layout:Label'));
$oTabsLayout->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('horizontal', Dict::S('UI:Tabs:Layout:Horizontal'), 'horizontal' === $sTabsLayoutValue));
$oTabsLayout->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('vertical', Dict::S('UI:Tabs:Layout:Vertical'), 'vertical' === $sTabsLayoutValue));
$oTabsForm->AddSubBlock($oTabsLayout);
// Tab navigation
$sTabsScrollableValue = appUserPreferences::GetPref('tab_scrollable', false);;
$oTabsScrollable = InputUIBlockFactory::MakeForSelectWithLabel('tab_scrollable', Dict::S('UI:Tabs:Scrollable:Label'));
$oTabsScrollable->GetInput()->AddSubBlock(SelectOptionUIBlockFactory::MakeForSelectOption('true', Dict::S('UI:Tabs:Scrollable:Scrollable'), true === $sTabsScrollableValue));
@@ -501,8 +509,16 @@ try {
DisplayPreferences($oPage);
break;
case 'apply_tab_config':
$bScrollable= utils::ReadParam('tab_scrollable', 'false') === 'true';
$sLayout = utils::ReadParam('tab_layout', 'horizontal');
$sLayoutAllowedValues = ['horizontal', 'vertical'];
if(in_array($sLayout, $sLayoutAllowedValues, true))
{
appUserPreferences::SetPref('tab_layout', $sLayout);
}
$bScrollable = utils::ReadParam('tab_scrollable', 'false') === 'true';
appUserPreferences::SetPref('tab_scrollable', $bScrollable);
DisplayPreferences($oPage);
break;
case 'apply_language':
$sLangCode = utils::ReadParam('language', 'EN US');