Custom rendering of a “repeated” field from Symfony 2 in Twig

前端 未结 5 1761
南旧
南旧 2020-12-23 20:56

I just started using Twig and I\'m trying to build a registration form. To add a password/re-enter password field I use the \"repeated\" filetype:

->add(\         


        
5条回答
  •  一个人的身影
    2020-12-23 21:27

    After a random guess I solved my own problem. I'll post it here so others who might come to this question by searching also know the answer:

    {% for passwordField in form.password %}
        
    {{ form_label(passwordField, null, { 'attr': {'class': 'form-label'} }) }} {{ form_widget(passwordField, { 'attr': {'class': 'form-input'} }) }}
    {% endfor %}

提交回复
热议问题