Changing the way widgets are rendered/displayed in a form on the template

Posted by user334017 on Stack Overflow See other posts from Stack Overflow or by user334017
Published on 2010-06-02T20:28:14Z Indexed on 2010/06/02 20:34 UTC
Read the original article Hit count: 151

Filed under:
|

I have a form with a few other embedded forms and some various widgets. The widgets are all saved in an array $form['elements'] and for some of them, I want to display labels and things, but for others I only want to display the basic rendering.

foreach($form['elements'] as $elem)
  echo $elem->render();

this displays everything about the widget. The way it is right now, I couldn't for example call $elem['..'] because the different subforms appear in a random order and have different variable names. I assume I could still put some checks in the template, but it seems easier to fix this in the widget class, like override one of the render functions or something. How would I go about doing this or do you have any links that could help me understand how do do this?

on a side note, one of my widgets is the sfWidgetFormChoice and I have no clue where it actually renders or how renderer_classes work

© Stack Overflow or respective owner

Related posts about symfony

Related posts about symfony-1.4