I have an edit form, The form is made through symfony2 Form types. I checked the documentation but couldn’t find any option for adding CSS to the form. The form display the data correctly and everything is fine what I want to do is to add styling to each field.
My Edit Type is
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('id', 'hidden')
->add('patent_name', 'text', array('label' => 'Patent Name'))
->add('description', 'textarea', array('label' => 'Description', 'required' => false))
->add('appln_auth','text', array('label' => 'Application Authorization'))
;
}
Anyone has any idea ho I can add css ?
Thanks
Here is the way you can do it when building your form,
You can also do it when rendering your form fields, take a look at Twig template form function reference
You can then add a css file in your bundle public assets and call it in your template using,
You’ve then to make your public assets be accessible through your web/ directory.
The best way to do it is to create symbolic links targeting your bundle public assets, you’ve then to execute
Another useful approach when you want to thoroughly customize specific form field rendering block (Twig) is to define a new form theme, here’s the documentation > Form theming in Twig.