In my PHP-project which uses the Symfony2 Framework, I’m using the Symfony2 Form-component. Inside a FormType-class adding a text field for instance would look something like this:
$options = array('error_bubbling' => true, 'required' => false);
$builder->add('username', 'text', $options);
Now by default all text field types have the option “error_bubbling” set to false, and “required” set to true. Because I always set error_bubbling to true and required to false, I would like to change the default options of all field types. How can I achieve this?
By implementing your own Field Types. There is no way to influence Symfony’s standard field types.