2021-07-26 11:16:52 +02:00
|
|
|
<?php
|
|
|
|
$panelHTML = '';
|
|
|
|
if (isLeaf($panelSettings)) {
|
|
|
|
$singleSetting = $this->element('Settings/fieldGroup', [
|
|
|
|
'panelName' => $panelName,
|
|
|
|
'panelSettings' => $panelSettings,
|
|
|
|
'settingName' => $panelName,
|
|
|
|
'setting' => $panelSettings,
|
|
|
|
]);
|
|
|
|
$panelHTML = "<div>{$singleSetting}</div>";
|
|
|
|
} else {
|
2021-07-30 08:18:30 +02:00
|
|
|
$panelID = getResolvableID($sectionName, $panelName);
|
2021-09-03 10:48:18 +02:00
|
|
|
$panelHTML .= sprintf('<h4 id="%s"><a class="text-reset text-decoration-none" href="#%s">%s%s</a></h4>',
|
|
|
|
$panelID,
|
|
|
|
$panelID,
|
2021-09-17 17:51:45 +02:00
|
|
|
!empty($panelSettings['_icon']) ? $this->Bootstrap->icon($panelSettings['_icon'], ['class' => 'me-1']) : '',
|
2021-09-03 10:48:18 +02:00
|
|
|
h($panelName)
|
|
|
|
);
|
|
|
|
if (!empty($panelSettings['_description'])) {
|
|
|
|
$panelHTML .= $this->Bootstrap->genNode('div', [
|
|
|
|
'class' => ['mb-1',],
|
|
|
|
], h($panelSettings['_description']));
|
|
|
|
}
|
2021-07-26 11:16:52 +02:00
|
|
|
$groupIssueSeverity = false;
|
|
|
|
foreach ($panelSettings as $singleSettingName => $singleSetting) {
|
2021-09-03 10:48:18 +02:00
|
|
|
if (substr($singleSettingName, 0, 1) == '_') {
|
|
|
|
continue;
|
|
|
|
}
|
2021-07-26 11:16:52 +02:00
|
|
|
$singleSettingHTML = $this->element('Settings/fieldGroup', [
|
|
|
|
'panelName' => $panelName,
|
|
|
|
'panelSettings' => $panelSettings,
|
|
|
|
'settingName' => $singleSettingName,
|
|
|
|
'setting' => $singleSetting,
|
|
|
|
]);
|
2021-09-17 17:51:45 +02:00
|
|
|
$panelHTML .= sprintf('<div class="ms-3">%s</div>', $singleSettingHTML);
|
2021-07-26 11:16:52 +02:00
|
|
|
if (!empty($singleSetting['error'])) {
|
|
|
|
$settingVariant = $this->get('variantFromSeverity')[$singleSetting['severity']];
|
|
|
|
if ($groupIssueSeverity != 'danger') {
|
|
|
|
if ($groupIssueSeverity != 'warning') {
|
|
|
|
$groupIssueSeverity = $settingVariant;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$panelHTML = $this->Bootstrap->genNode('div', [
|
|
|
|
'class' => [
|
|
|
|
'shadow',
|
|
|
|
'p-2',
|
|
|
|
'mb-4',
|
|
|
|
'rounded',
|
|
|
|
'settings-group',
|
2021-09-28 10:59:57 +02:00
|
|
|
'callout',
|
|
|
|
(!empty($groupIssueSeverity) ? "callout-${groupIssueSeverity}" : ''),
|
2021-07-26 11:16:52 +02:00
|
|
|
],
|
|
|
|
], $panelHTML);
|
|
|
|
}
|
|
|
|
echo $panelHTML;
|