|
|
|
@ -128,12 +128,35 @@ class html_form { |
|
|
|
$skip_output = []; |
|
|
|
$skip_output = []; |
|
|
|
foreach(SafeIO::esv($input['html']) as $html) { |
|
|
|
foreach(SafeIO::esv($input['html']) as $html) { |
|
|
|
$key = $html['name'] ?? ""; |
|
|
|
$key = $html['name'] ?? ""; |
|
|
|
|
|
|
|
$alt = $html['meta']['alt'][$key] ?? null; |
|
|
|
|
|
|
|
if (isset($alt)) { |
|
|
|
|
|
|
|
$alt_name = $alt[0] ?? null; |
|
|
|
|
|
|
|
$alt_value = $alt[1] ?? null; |
|
|
|
|
|
|
|
if (isset($alt_name) && isset($alt_value)) { |
|
|
|
|
|
|
|
$html_output[$alt_name] = $alt_value; |
|
|
|
|
|
|
|
} else { |
|
|
|
$html_output[$key] = $html['html']; |
|
|
|
$html_output[$key] = $html['html']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$html_output[$key] = $html['html']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$headers[$key] = $html['meta']['field_desc'][$key] ?? ""; |
|
|
|
$headers[$key] = $html['meta']['field_desc'][$key] ?? ""; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (isset($alt_name)) { |
|
|
|
$skipping = $html['meta']['skip_output'][$key] ?? null; |
|
|
|
$skipping = $html['meta']['skip_output'][$key] ?? null; |
|
|
|
if ($skipping === true) { |
|
|
|
if ($skipping === true) { |
|
|
|
|
|
|
|
// skip both alt_name and key |
|
|
|
|
|
|
|
$skip_output[$alt_name] = true; |
|
|
|
$skip_output[$key] = true; |
|
|
|
$skip_output[$key] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$skipping = $html['meta']['skip_output'][$key] ?? null; |
|
|
|
|
|
|
|
if ($skipping === true) { |
|
|
|
|
|
|
|
$skip_output[$key] = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$show_labels = $html['meta']['show_label'][$key] ?? true; |
|
|
|
$show_labels = $html['meta']['show_label'][$key] ?? true; |
|
|
|
$form_type = $html['meta']['form_type'][$key] ?? FORM_TYPE::text; |
|
|
|
$form_type = $html['meta']['form_type'][$key] ?? FORM_TYPE::text; |
|
|
|
$form_data_list = $html['meta']['form_data_list'][$key] ?? []; |
|
|
|
$form_data_list = $html['meta']['form_data_list'][$key] ?? []; |
|
|
|
@ -360,12 +383,22 @@ class html_form { |
|
|
|
$html .= $this->build_options($children, $selected); |
|
|
|
$html .= $this->build_options($children, $selected); |
|
|
|
$html .= '</optgroup>'; |
|
|
|
$html .= '</optgroup>'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if ($value === "none") { |
|
|
|
|
|
|
|
$option[] = 'disabled'; |
|
|
|
|
|
|
|
$option[] = 'hidden'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$option['value'] ??= $value; |
|
|
|
$option['value'] ??= $value; |
|
|
|
$label = $option['label'] ?? $option['value']; |
|
|
|
$label = $option['label'] ?? $option['value']; |
|
|
|
unset($option['label']); |
|
|
|
unset($option['label']); |
|
|
|
|
|
|
|
|
|
|
|
if (in_array($option['value'], $selected)) { |
|
|
|
if (in_array($option['value'], $selected)) { |
|
|
|
$option[] = 'selected'; |
|
|
|
$option[] = 'selected'; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if ($value === "none") { |
|
|
|
|
|
|
|
$option[] = 'selected'; |
|
|
|
|
|
|
|
$option['value'] = ""; // Force User to select... |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$html .= '<option'.$this->html->attributes($option).'>'.$this->html->escape($label).'</option>'; |
|
|
|
$html .= '<option'.$this->html->attributes($option).'>'.$this->html->escape($label).'</option>'; |
|
|
|
|