printFieldHeader($field );
echo $this->{$field["type"]}($field);
$this->printFieldFooter();
}
/**
* Stampa una sezione basandosi sul modello concettuale
*
* @param ?String $name nome della sezione
* @param Array $section struttura della sezione
* @return void
*/
function printSection(?String $name, Array $section) {
// WORKAROUND se un field si trova nella root
if(str_starts_with($name, "eforms2")) {
return $this->printField($section);
}
// Repeatable
if(!isset($section["__meta"])) {
foreach($section as $key => $member) {
$this->printSection($key, $member);
}
return;
}
extract($section["__meta"]);
// Extract __meta fields as variables
// Clear them from the array
unset($section["__meta"]);
$auto_collapse = str_contains(strtolower($name), "unpublish");
$collapsed = $auto_collapse ? "collapsed" : "";
$collapse_button = $this->button(
[
"name" => "button",
"required" => false,
"size" => "pr-2",
"type" => "button",
"title" => "",
"attrs" => [
"data-toggle" => "collapse",
"data-target" => "#collapse-{$unique_identifier}",
"class" => "btn btn-sm btn-block btn-outline-secondary mr-2 {$collapsed}",
]
]);
// Display headers
if($display_type == "SECTION") {
$this->printSectionHeader($this->translate($label), $id, $unique_identifier, $collapse_button);
} else if($display_type == "GROUP") {
$add_button = $delete_button = "";
// First iteration
if($repeatable) {
if($iteration == 0) {
$add_button = $this->createAddButton($unique_identifier, $section_object, $this->notice, $this->info['codice'], $prefix);
} elseif($preventDelete === false) {
$delete_button = $this->createDeleteButton($unique_identifier);
}
}
$this->printGroupHeader(
$this->translate($label),
$id,
$unique_identifier,
$repeatable,
$iteration,
$total_iterations,
$add_button,
$delete_button,
$collapse_button,
$tabNameProvider ?? $this->translate($label) . " - " . ($iteration + 1)
);
}
// For each member
foreach($section as $key => $member) {
// Print iteration
if($display_type == "SECTION") {
}
if(isset($member["name"])) {
$this->printField($member);
} else {
// Section
$this->printSection($key, $member);
}
}
if($display_type == "SECTION") {
$this->printSectionFooter();
}
if($display_type == "GROUP") {
$this->printGroupFooter(
$this->translate($label),
$id,
$unique_identifier,
$repeatable,
$iteration,
$total_iterations,
$add_button,
$delete_button,
$collapse_button
);
}
}
/**
* Print GUUE FORM
*
* @param mixed $section
* @return void
*/
public function printForm(Array $section, Int $subsection_index) : void {
$full_structure = [];
$section_structure = $this->createFormStructure($section, $subsection_index, true, $full_structure);
if($_SESSION["utente"]->isSupportoOrRoot()) {
// Print settings toggles
?>
printNoEFXButton($this->enable_efx_evaluation);
$this->printShowLabelsButton($this->hide_labels);
$this->printDebugEfxButton($this->advanced_debug);
$this->printForcedSuggestionsButton($this->enable_forced_suggestions);
// Print debug area
if($this->mode === "edit" && $this->advanced_debug) {
?>
printDebugArea($full_structure);
?>
renderIntegrationHelpers("floating");
echo "";
$ready = empty($this->info["codice"]) ? "" : "data-ready=1";
echo "