Nette 2.1.0 (stable): Issue with form n:name macro and other macros in HTML attributes

6 years ago

_Martin_
Generous Backer | 680
+
0
-

Following Latte code

<textarea n:name="summary" placeholder="{_ 'write summary here'}" rows="3" class="input-xxlarge span10">{$form['summary']->value}</textarea>

generates broken PHP

<textarea placeholder="<?php echo htmlSpecialChars($template-><?php echo $_input->getControl()->getHtml() ?></textarea>

It's not a bug in translation macro, placeholder="{$basePath}" generates broken code too, but in another way:

<textarea placeholder="<?php echo htmlSpecialChars($basePath) ;echo $_input->getControl()->getHtml() ?></textarea>

Last edited by _Martin_ (2014-01-19 14:14)

6 years ago

_Martin_
Generous Backer | 680
+
0
-

It seems like paired tags issue: textarea fails, input is OK.

6 years ago

Filip Procházka
Moderator | 4693
+
0
-

This does not look like a code generated by translation macro, paste the whole generated tag.

6 years ago

_Martin_
Generous Backer | 680
+
0
-

I don't use default translation macro, but this https://addons.nette.org/…e-translator. That's reason, why I mentioned second example without translation macro.

Check this another example, generated code is exactly the same, as in translation macro:

<textarea n:name="summary" placeholder="{10|number:2}" rows="3" class="input-xxlarge span10">{$form['summary']->value}</textarea>

And generated code:

<textarea placeholder="<?php echo htmlSpecialChars($template-><?php echo $_input->getControl()->getHtml() ?></textarea>

Last edited by _Martin_ (2014-01-19 15:46)

6 years ago

David Grudl
Nette Core | 6889
+
0
-

Problem is here https://github.com/…rmMacros.php#L194.

Finding the end of HTML tag is tricky (same here https://github.com/…UIMacros.php#L306), there should be some way how do it correctly.