wizard doc minor fix

This commit is contained in:
fbsanchez 2019-10-31 21:15:18 +01:00
parent 115c884cd4
commit aa30a12f31
1 changed files with 16 additions and 8 deletions

View File

@ -436,11 +436,15 @@ class Wizard
* *
* @param array $input Definition of target block to be printed. * @param array $input Definition of target block to be printed.
* @param boolean $return Return as string or direct output. * @param boolean $return Return as string or direct output.
* @param boolean $direct Avoid encapsulation if input print is direct.
* *
* @return string HTML content. * @return string HTML content.
*/ */
public function printBlock(array $input, bool $return=false, bool $not_direct=false) public function printBlock(
{ array $input,
bool $return=false,
bool $direct=false
) {
$output = ''; $output = '';
if ($input['hidden'] == 1) { if ($input['hidden'] == 1) {
$class = ' hidden'; $class = ' hidden';
@ -453,7 +457,7 @@ class Wizard
} }
if (is_array($input['block_content']) === true) { if (is_array($input['block_content']) === true) {
$not_direct = (bool) $input['direct']; $direct = (bool) $input['direct'];
// Print independent block of inputs. // Print independent block of inputs.
$output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">'; $output .= '<li id="li-'.$input['block_id'].'" class="'.$class.'">';
@ -462,17 +466,21 @@ class Wizard
$output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">'; $output .= '<'.$input['wrapper'].' id="'.$input['block_id'].'" class="'.$class.'">';
} }
if (!$not_direct) { if (!$direct) {
// Avoid encapsulation if input is direct => 1. // Avoid encapsulation if input is direct => 1.
$output .= '<ul class="wizard '.$input['block_class'].'">'; $output .= '<ul class="wizard '.$input['block_class'].'">';
} }
foreach ($input['block_content'] as $input) { foreach ($input['block_content'] as $input) {
$output .= $this->printBlock($input, $return, (bool) $not_direct); $output .= $this->printBlock(
$input,
$return,
(bool) $direct
);
} }
// Close block. // Close block.
if (!$not_direct) { if (!$direct) {
$output .= '</ul>'; $output .= '</ul>';
} }
@ -483,7 +491,7 @@ class Wizard
$output .= '</li>'; $output .= '</li>';
} else { } else {
if ($input['arguments']['type'] != 'hidden') { if ($input['arguments']['type'] != 'hidden') {
if (!$not_direct) { if (!$direct) {
$output .= '<li id="'.$input['id'].'" class="'.$class.'">'; $output .= '<li id="'.$input['id'].'" class="'.$class.'">';
} }
@ -491,7 +499,7 @@ class Wizard
$output .= $this->printInput($input['arguments']); $output .= $this->printInput($input['arguments']);
// Allow dynamic content. // Allow dynamic content.
$output .= $input['extra']; $output .= $input['extra'];
if (!$not_direct) { if (!$direct) {
$output .= '</li>'; $output .= '</li>';
} }
} else { } else {