in symfony 1.4 it was possible to parameterize a form class definition, via the options of the form. Is there any way to pass custom options to my custom form type??? i’ve tried to use the options parameter of the buildForm method, but i’m not very sure what this array is, and apparently it is not for what i want… Thanks!
in symfony 1.4 it was possible to parameterize a form class definition, via the
Share
The solution is simple, if you want your custom option to be available also in Twig template, you must use
$builder->setAttribute()inbuildFormmethodand
$view->set()method inbuildView()method, too.Template for custom form type (file …Acme/DemoBundle/Resources/views/Form/fields.html.twig):
Register your template for custom form types in app/config/config.yml
Usage: Display preview of user’s image while editing his profile:
2014-08-18: Updated for Symfony 2.1 or higher