I have got form like that: One input field - Text with name trollName.
namespace Acme\MyBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class myFormType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('trollName','text')
;
}
}
Some controller:
$myForm = $this->createForm(new myFormType()) -> createView();
I want to render this field, but I want to use bootstrap class - form-control
How to modify twig view:
{{ form_widget(myForm.trollName) }}
... to get response like that:
<input type='text' name='trollName' class='form-control'> <!-- form-control class is from boostrap -->