diff --git a/src/Bridges/Latte/Macros/BaseInputMacros.php b/src/Bridges/Latte/Macros/BaseInputMacros.php index 1df609a..ae3e6a1 100644 --- a/src/Bridges/Latte/Macros/BaseInputMacros.php +++ b/src/Bridges/Latte/Macros/BaseInputMacros.php @@ -44,8 +44,8 @@ public function macroLabel(MacroNode $node, PhpWriter $writer) $name = array_shift($words); return $writer->write( ($name[0] === '$' - ? '$_input = is_object(%0.word) ? %0.word : $_form[%0.word];' - : '$_input = $_form[%0.word];' + ? '$_input = is_object(%0.word) ? %0.word : end($this->global->formsStack)[%0.word];' + : '$_input = end($this->global->formsStack)[%0.word];' ) . 'if ($_label = $_input->%1.raw) echo ' . $class . '::label($_label->addAttributes(%node.array), $_input, %2.var)', $name, $words ? ('getLabelPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')') : 'getLabel()', @@ -79,8 +79,8 @@ public function macroInput(MacroNode $node, PhpWriter $writer) $name = array_shift($words); return $writer->write( ($name[0] === '$' - ? '$_input = is_object(%0.word) ? %0.word : $_form[%0.word];' - : '$_input = $_form[%0.word];' + ? '$_input = is_object(%0.word) ? %0.word : end($this->global->formsStack)[%0.word];' + : '$_input = end($this->global->formsStack)[%0.word];' ) . 'echo ' . $class . '::input($_input->%1.raw->addAttributes(%node.array), $_input, %2.var)', $name, $words ? 'getControlPart(' . implode(', ', array_map([$writer, 'formatWord'], $words)) . ')' : 'getControl()',