优化插件配置分组

优化版本依赖
pull/462/MERGE
Karson 2024-03-28 09:58:30 +08:00
parent 2b14bc4e2b
commit b7eef593a3
2 changed files with 7 additions and 2 deletions

View File

@ -95,19 +95,24 @@ class Addon extends Backend
} }
$tips = []; $tips = [];
$groupList = []; $groupList = [];
$ungroupList = [];
foreach ($config as $index => &$item) { foreach ($config as $index => &$item) {
//如果有设置分组 //如果有设置分组
if (isset($item['group']) && $item['group']) { if (isset($item['group']) && $item['group']) {
if (!in_array($item['group'], $groupList)) { if (!in_array($item['group'], $groupList)) {
$groupList["custom" . (count($groupList) + 1)] = $item['group']; $groupList["custom" . (count($groupList) + 1)] = $item['group'];
} }
} elseif ($item['name'] != '__tips__') {
$ungroupList[] = $item['name'];
} }
if ($item['name'] == '__tips__') { if ($item['name'] == '__tips__') {
$tips = $item; $tips = $item;
unset($config[$index]); unset($config[$index]);
} }
} }
if ($ungroupList) {
$groupList['other'] = '其它'; $groupList['other'] = '其它';
}
$this->view->assign("groupList", $groupList); $this->view->assign("groupList", $groupList);
$this->view->assign("addon", ['info' => $info, 'config' => $config, 'tips' => $tips]); $this->view->assign("addon", ['info' => $info, 'config' => $config, 'tips' => $tips]);
$configFile = ADDON_PATH . $name . DS . 'config.html'; $configFile = ADDON_PATH . $name . DS . 'config.html';

View File

@ -27,7 +27,7 @@
"fastadmin-cxselect": "~1.4.0", "fastadmin-cxselect": "~1.4.0",
"fastadmin-dragsort": "~1.0.0", "fastadmin-dragsort": "~1.0.0",
"fastadmin-addtabs": "~1.0.8", "fastadmin-addtabs": "~1.0.8",
"fastadmin-selectpage": "~1.0.6", "fastadmin-selectpage": "~1.0.12",
"fastadmin-layer": "~3.5.1", "fastadmin-layer": "~3.5.1",
"bootstrap-slider": "*" "bootstrap-slider": "*"
} }