skipping headers

main
Robert 1 month ago
parent 37cf518538
commit 0fc6bd6186
  1. 5
      src/bootstrap/safer_io.php
  2. 13
      src/classes/form_builder/html_form.php
  3. 8
      src/classes/html.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;
}

@ -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 {

@ -72,7 +72,10 @@ final class html {
$ret = self::do_echo("{$nl}<table {$table}>{$nl}", $echo);
$ret .= self::do_echo("\t<tr>{$nl}", $echo);
foreach($header_fields as $header_field) {
foreach($header_fields as $name=>$header_field) {
$skipping = $options['skip_output'][$name] ?? false;
if ($skipping) continue;
$field = ($escape) ? \CodeHydrater\bootstrap\safer_io::h($header_field) : $header_field;
$ret .= self::do_echo("\t\t<th{$th_class}>{$field}</th>{$nl}", $echo);
}
@ -150,6 +153,9 @@ final class html {
$nl = PHP_EOL;
$ret = self::do_echo("\t<tr{$row_class_tag}>{$nl}", $echo);
foreach($record as $key => $value) {
$skipping = $options['skip_output'][$key] ?? false;
if ($skipping) continue;
if (! is_string($key)) {
continue; // Remove Duplicate records
}

Loading…
Cancel
Save