I'm starting to get the hang of the new admin generator and form
framework, but I'm still struggling with some details.

A while ago I created a new widget type for displaying plain text
which does not need to saved to the database.  I use this for things
like 'updated_at' or 'created_at' timestamps which are not editable by
the user.  The problem I'm facing now is a bit more complicated.  I
want to be able to define options for fields in the admin generator's
generator.yml which I can get at in my widget in order to modify its
behavior.

The specific use case I'm going for now: I've created a new widget
called 'sfWidgetFormPlainDate'.  This is for displaying timestamps as
described above.  The problem I have is that although I have defined a
date_format for these fields in my generator.yml, I cannot for the
life of me figure out how to get that setting into my widget in such a
way that I can actually use it.  It looks like the generator passes on
any parameters that are under the name "attributes" in your field
definition to the render method of the widget, so I could conceivably
stuff a date format field in there.  But the attributes field is
clearly meant to be for html attributes, not arbitrary formatting
options.

I suppose I could define the date format in the form class, which is
probably what I will do for now, but this means I need to define the
date format in two different places: once in yaml for displaying the
date in the list view of the admin generator, and once in code for
formatting the widget itself.  Not very DRY.

Any suggestions on how I can eliminate this duplication?

Thanks,

David Brewer

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to