diff --git a/src/bootstrap/safer_io.php b/src/bootstrap/safer_io.php index 2b4736b..375dfc6 100644 --- a/src/bootstrap/safer_io.php +++ b/src/bootstrap/safer_io.php @@ -47,6 +47,7 @@ final class use_io { public ?string $form_check_or_radio_value = null; public ?string $form_check_or_radio_name = null; public bool $show_label = true; + public ?bool $skip_output = null; public ?string $div_class = null; public ?string $label_class = null; public ?string $form_control_class = null; @@ -504,6 +505,10 @@ final class safer_io { $meta['form_ctrl']['value'][$input_field_name] = $a->form_check_or_radio_value; } + if (isset($a->skip_output)) { + $meta['skip_output'][$input_field_name] = $a->skip_output; + } + if (isset($a->show_label)) { $meta['show_label'][$input_field_name] = $a->show_label; } diff --git a/src/classes/form_builder/html_form.php b/src/classes/form_builder/html_form.php index 2d5e64d..0c18499 100644 --- a/src/classes/form_builder/html_form.php +++ b/src/classes/form_builder/html_form.php @@ -125,10 +125,15 @@ class html_form { $html_output = []; $errors = []; $headers = []; + $skip_output = []; foreach(SafeIO::esv($input['html']) as $html) { $key = $html['name'] ?? ""; $html_output[$key] = $html['html']; $headers[$key] = $html['meta']['field_desc'][$key] ?? ""; + $skipping = $html['meta']['skip_output'][$key] ?? null; + if ($skipping === true) { + $skip_output[$key] = true; + } $show_labels = $html['meta']['show_label'][$key] ?? true; $form_type = $html['meta']['form_type'][$key] ?? FORM_TYPE::text; $form_data_list = $html['meta']['form_data_list'][$key] ?? []; @@ -199,13 +204,17 @@ class html_form { $label_name = $label ?? $key; $r_a['placeholder'] = $label_name; } - $input_name = (isset($form_ctrl['name'])) ? $form_ctrl['name'] : $key; $this->$type_of_form_input($input_name, array_merge($fc, ['id'=>$key, 'value'=>$value], $r_a)); $this->close_div(); } - return ['html_output'=>$html_output, 'headers'=>$headers, 'errors'=>$errors]; + return [ + 'html_output'=>$html_output, + 'headers'=>$headers, + 'skip_output'=>$skip_output, + 'errors'=>$errors + ]; } private function do_escape(string $content, array & $options): ?string { diff --git a/src/classes/html.php b/src/classes/html.php index b880b38..9b4efa2 100644 --- a/src/classes/html.php +++ b/src/classes/html.php @@ -72,7 +72,10 @@ final class html { $ret = self::do_echo("{$nl}
| {$field} | {$nl}", $echo); } @@ -150,6 +153,9 @@ final class html { $nl = PHP_EOL; $ret = self::do_echo("\t
|---|