'danger', 'warning' => 'warning', 'info' => 'info', ]; $includeScrollspy = !empty($includeScrollspy); $groupedContent = []; $scrollSpyContent = []; foreach ($settings as $sectionName => $sectionContent) { if (!empty($sectionContent)) { $groupedContent[] = $this->element('Settings/section', [ 'sectionName' => $sectionName, 'sectionContent' => $sectionContent, ]); } else { $groupedContent[] = ''; } if ($includeScrollspy) { if (!isLeaf($sectionContent)) { $scrollSpyContent[$sectionName] = array_filter( // only show grouped settings array_keys($sectionContent), function ($settingGroupName) use ($sectionContent) { return !isLeaf($sectionContent) && !empty($sectionContent[$settingGroupName]); } ); } } } $contentHtml = implode('', $groupedContent); if ($includeScrollspy) { $scrollspyNav = $this->element('Settings/scrollspyNav', [ 'groupedSetting' => $scrollSpyContent ]); } $mainPanelHeight = 'calc(100vh - 42px - 1rem - 56px - 38px - 1rem)'; ?>