From 3ea877fe10965f03550d97b5ccc678c61c4f7b9c Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Tue, 12 Oct 2021 10:21:12 +0200 Subject: [PATCH] chg: [ui:settings] Refactored setting factory to be more generic --- templates/Instance/settings.php | 144 +++++--------------- templates/element/Settings/category.php | 61 +++++++++ templates/element/Settings/panel.php | 17 +++ templates/element/Settings/scrollspyNav.php | 13 ++ templates/element/Settings/section.php | 46 +++++++ 5 files changed, 169 insertions(+), 112 deletions(-) create mode 100644 templates/element/Settings/category.php create mode 100644 templates/element/Settings/section.php diff --git a/templates/Instance/settings.php b/templates/Instance/settings.php index 5e85df6..20215c6 100644 --- a/templates/Instance/settings.php +++ b/templates/Instance/settings.php @@ -5,8 +5,24 @@ $variantFromSeverity = [ 'warning' => 'warning', 'info' => 'info', ]; -$this->set('variantFromSeverity', $variantFromSeverity); -$settingTable = genNavcard($settingsProvider, $this); + +$navLinks = []; +$tabContents = []; + +foreach ($settingsProvider as $settingTitle => $settingContent) { + $navLinks[] = h($settingTitle); + $tabContents[] = $this->element('Settings/category', [ + 'settings' => $settingContent, + 'includeScrollspy' => true, + ]); +} + +array_unshift($navLinks, __('Settings Diagnostic')); +$notice = $this->element('Settings/notice', [ + 'variantFromSeverity' => $variantFromSeverity, + 'notices' => $notices, +]); +array_unshift($tabContents, $notice); ?>