php - Add class in some tags via twig template? -


this question has answer here:

add class form tag

i made form

    $form = $this->createformbuilder()           ->add('name')     ->add('tel')     ->add('save','submit')     ->getform(); 

in index.html.twig

  {{ form_start(form)}}   {{ form_rest(form)}}   {{ form_end(form)}}  

normally works well

but want add class form tag this

<form class=“niceform”>  <button type="submit" class="btn btn-primary"> 

how can kind of things via formbuilder , twig template??

via doc: http://symfony.com/doc/current/reference/forms/twig_reference.html#form-widget-view-variables

form_widget(view, variables)

{# render widget, add "foo" class #} {{ form_widget(form.name, {'attr': {'class': 'foo'}}) }} 

Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -