php - Add class in some tags via twig template? -
this question has answer here:
- add specific css-class symfony2 form 1 answer
 
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
Post a Comment