Initialize form renderer when randering form manually

Notice: This thread is very old.

5 years ago

Milo
Nette Core | 1153
+
0
-

I'm using own FormRenderer (like this one) and I'm rendering form manually by <form n:name=...> or by {form ...}.

In this case, Form::render() is not called and I don't know, where to place a hook for controls adjusting. For example, how to set class btn-sm for all submit buttons.

One possible solution is to refactor internal FormsLatte\Runtime to use Form::render('begin'). In that case, I can overload DefaultFormRenderer::renderBegin() method. But it's not so nice.

Another possible solution is to add onBeforeRender() event somewhere, I'm not sure how yet.

So, I'm looking for the cleaner solution :o) Some tips or experiences? I'll send PR.

5 years ago

Milo
Nette Core | 1153
+
0
-

As a workaround, I'm using following code in template:

{$presenter['filter']->render('workaround')}