How can I set the HTML class attribute to a form using the FormBuilder in Symfony2 ?
HTML
class
FormBuilder
Symfony2
S
You can add it in the options of your form class:
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults(array( 'data_class' => 'AppBundle\Entity\MyEntity', 'attr' => array( 'class' => 'form-horizontal' ) )); }