adasd
This commit is contained in:
@@ -13,6 +13,16 @@ if (!$module) {
|
||||
}
|
||||
|
||||
$fields = (array)($module['setup']['fields'] ?? []);
|
||||
$fieldTypes = [];
|
||||
$fieldMeta = [];
|
||||
foreach ($fields as $field) {
|
||||
$fname = (string)($field['name'] ?? '');
|
||||
if ($fname === '') {
|
||||
continue;
|
||||
}
|
||||
$fieldTypes[$fname] = (string)($field['type'] ?? 'text');
|
||||
$fieldMeta[$fname] = $field;
|
||||
}
|
||||
$current = modules()->settings($moduleName);
|
||||
$defaults = $module['db_defaults'] ?? [];
|
||||
if (empty($current['db']) && is_array($defaults)) {
|
||||
@@ -28,7 +38,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
if ($name === '') {
|
||||
continue;
|
||||
}
|
||||
$type = (string)($field['type'] ?? 'text');
|
||||
$value = $_POST[$name] ?? null;
|
||||
|
||||
if ($type === 'checkbox') {
|
||||
$value = isset($_POST[$name]) ? '1' : '0';
|
||||
}
|
||||
if (is_array($value)) {
|
||||
continue;
|
||||
}
|
||||
@@ -54,7 +69,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
modules()->saveSettings($moduleName, $payload);
|
||||
$notice = 'Setup gespeichert.';
|
||||
$current = modules()->settings($moduleName);
|
||||
$current = array_replace_recursive($current, $payload);
|
||||
}
|
||||
?>
|
||||
<div class="card">
|
||||
|
||||
Reference in New Issue
Block a user