Symfony 1.1 Form Templating
So, I'm tired of how the forms look in symfony 1.1. I mean c'mon, tables? We can do better than that.
Note: we can do better than my solution too, I'm sure, but this is way better than tables!
So inside of
And, from there we need to tell our form to use our own formatter, so in your
And that's it! Quite simple really. (When the form is rendered, symfony will look for
For full customisation, have a look in
For examples of other implementations, symfony have their own formatters:
Good luck!
Note: we can do better than my solution too, I'm sure, but this is way better than tables!
So inside of
/lib/widget, I've created sfWidgetFormSchemaFormatterJosh.class.php which looks a little like:And, from there we need to tell our form to use our own formatter, so in your
sfForm (child) class, in either configure() or setup() (I use setup() - I don't know if there is a difference, really. Is there? Anyone?), add the following line:And that's it! Quite simple really. (When the form is rendered, symfony will look for
$class = 'sfWidgetFormSchemaFormatter' . ucfirst($name); (where $name is 'josh', or whatever you called your formatter), and does the rendering using that class!)For full customisation, have a look in
sfWidgetFormSchemaFormatter, and look at the protected variables at the top. They're what you have to play with.For examples of other implementations, symfony have their own formatters:
sfWidgetFormSchemaFormatterTable (default) and sfWidgetFormSchemaFormatterList.Good luck!