I'm using a custom Widget for date fields, and I want to use it in all my forms. The problem is that symfony uses the default sfWidgetFormDate. What I want is to change this default widget in order to generate forms with my custom Widget. I don't want to change by hand all the forms generated.
The only approach I have found is the trik of modify BaseFormDoctrine.php:
public function setup()
{
foreach($this->getWidgetSchema()->getFields() as $name=>$widget)
{
if($widget instanceof sfWidgetFormDate)
{
$this->widgetSchema[$name] = new sfWidgetFormJQueryDate(array(
'config' => '{}',
'image'=>'/images/calendar.png',
));
}
}
}