'danger', 'warning' => 'warning', 'info' => 'info', ]; $this->set('variantFromSeverity', $variantFromSeverity); $settingTable = genNavcard($settingsProvider, $this); ?>
element('Settings/search', [ ]); ?>
$sectionSettings) { if (!empty($sectionSettings)) { $cardContent[] = genContentForNav($sectionSettings, $appView); } else { $cardContent[] = __('No Settings available yet'); } } array_unshift($cardNavs, __('Settings Diagnostic')); $notice = $appView->element('Settings/notice', [ 'variantFromSeverity' => $appView->get('variantFromSeverity'), ]); array_unshift($cardContent, $notice); $tabsOptions0 = [ // 'vertical' => true, // 'vertical-size' => 2, 'card' => false, 'pills' => false, 'justify' => 'center', 'nav-class' => ['settings-tabs'], 'data' => [ 'navs' => $cardNavs, 'content' => $cardContent ] ]; $table0 = $appView->Bootstrap->tabs($tabsOptions0); return $table0; } function genContentForNav($sectionSettings, $appView) { $groupedContent = []; $groupedSetting = []; foreach ($sectionSettings as $sectionName => $subSectionSettings) { if (!empty($subSectionSettings)) { $groupedContent[] = genSection($sectionName, $subSectionSettings, $appView); } else { $groupedContent[] = ''; } if (!isLeaf($subSectionSettings)) { $groupedSetting[$sectionName] = array_filter( // only show grouped settings array_keys($subSectionSettings), function ($settingGroupName) use ($subSectionSettings) { return !isLeaf($subSectionSettings[$settingGroupName]) && !empty($subSectionSettings[$settingGroupName]); } ); } } $contentHtml = implode('', $groupedContent); $scrollspyNav = $appView->element('Settings/scrollspyNav', [ 'groupedSetting' => $groupedSetting ]); $mainPanelHeight = 'calc(100vh - 42px - 1rem - 56px - 38px - 1rem)'; $container = '
'; $container .= "
{$scrollspyNav}
"; $container .= "
{$contentHtml}
"; $container .= '
'; return $container; } function genSection($sectionName, $subSectionSettings, $appView) { $sectionContent = []; $sectionContent[] = sprintf('
', sprintf('sp-%s', h($sectionName))); if (isLeaf($subSectionSettings)) { $panelHTML = $appView->element('Settings/panel', [ 'sectionName' => $sectionName, 'panelName' => $sectionName, 'panelSettings' => $subSectionSettings, ]); $sectionContent[] = $panelHTML; } else { foreach ($subSectionSettings as $panelName => $panelSettings) { if (!empty($panelSettings)) { $panelHTML = $appView->element('Settings/panel', [ 'sectionName' => $sectionName, 'panelName' => $panelName, 'panelSettings' => $panelSettings, ]); $sectionContent[] = $panelHTML; } else { $sectionContent[] = ''; } } } $sectionContent[] = '
'; return implode('', $sectionContent); } function isLeaf($setting) { return !empty($setting['name']) && !empty($setting['type']); } ?>