Ok, now I know there's no other solution, other then extending the core widgets. However, I believe this is a serious limitation, that coluld be over come by adding some flexibility in the core widgets.
I believe, Never hardcode, any sort of markup in your code. Here's my suggestion, that could be borrowed from a great Java web framework called Webwork (which is now merged into struts 2) It also have similar components like symfony form widgets, its called tags in webwork. How it handles rendering of this tags - There are widget templates (say some thing like out partials) that know how to render a widget. Widget it self does not know how to render the markup, it pass over this job to template. Whenever any widget needs to be rendered, the template is automatically loaded, passing it all the data required to render the widgets markup, and template knows how to render it. There are default templates for all the widgets. If u want custom one, Just have your own tempalte in classpath or specify it in config files and it will be loaded automatically and will handle rendering, This is seperation of responsibility. There are templates for generating HTML, XHTML and AJAX. You can generate virtually any sort of markup with your own templates. Widgets are no longer bound to generate HTML only. We already have most of the groundwork in symfony, required to implement these. Autoloading !! Reference: http://opensymphony.com/webwork http://wiki.opensymphony.com/display/WW/Themes+and+Templates http://wiki.opensymphony.com/display/WW/Form+Tags Thanks SN ----- Original Message ----- From: Java geek To: [email protected] Sent: Wednesday, July 15, 2009 12:21 PM Subject: [symfony-users] Custom rendering of widgets I want custom rendering of sfWidgetFormSelectCheckbox and sfWidgetFormSelectRadio widgets I don't want the default <ul> and <li> tags. I want divs instead and will need different tags on different screens. I know there's a solution, extend these widgets and provide custom formatter() method. But I think, this isn't a solution, and I feel there should be some other way to hook the custom formatting, I am not sure though. I don't want to extend them just to have different rendering. This is a very common task, one may need many different rendering of these widgets on different screens. Does that mean he will have to extend these widgets for each, and have five radio widgets for five different screens? This way I will endup extending those widgets many time, adding no extra functionality other than rendering. Is there any other way! Thanks Sudhir --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/symfony-devs?hl=en -~----------~----~----~----~------~----~------~--~---
