form macros: rendering form start and end

2 years ago

amik
Member | 124
+
0
-

Hi,
I'm working on a new version of instante/bootstrap3renderer for Nette 2.4, trying to completely re-factor, modernize and simplify the code so that it uses more of native Nette rendering behavior.
I've noticed that there are currently 2 methods capable of rendering form begin and end:

  • Nette\Bridges\FormsLatte\Runtime::renderFormBegin
  • Nette\Forms\Rendering\DefaultFormRenderer::renderBegin

They seem to behave very similarly. The first one is used when manually rendering using {form frm} macro, the second one using {control frm}. While the first one discards action's query parameters, the second one converts them to hidden fields.

I'm totally confused now. Is this intentional? Or is it planned to unify the render code (and which one is planned to remain in the future)? Understanding this would really help me developing the new Bootstrap renderer, which provides extending macros like {pair} a bit smarter way (and even useable for other custom renderers, not just Bootstrap renderer :) )

@DavidGrudl probably only you will know as author? :)

Thanks in advance.

P.S. sorry, I accidentally put this thread into “Beginners” instead of “Latte” forum, can mods please move it? :)

Last edited by amik (2016-08-09 08:17)

2 years ago

duke
Member | 628
+
0
-

In the case of {form} macro, the hiddens are added by the closing tag {/form} by method:

2 years ago

amik
Member | 124
+
0
-

duke wrote:

In the case of {form} macro, the hiddens are added by the closing tag {/form} by method:

yes, thats true :) but my question remains – does it have some reason for two ways of rendering form begin/end?

2 years ago

David Grudl
Nette Core | 6787
+
+2
-

DefaultFormRenderer is simply original and old way, still used, FormsLatte is new way via new macros. Feel free to unify it, it would be nice.