Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FOSUserBundle issues with plainPassword on twig form

I am defining my own twig layout for new user registration and I have everything laid out the way I want it with the exception of the plainPassword field from the FOSUserBundle.

<p class="left">
   {{ form_widget(form.plainPassword) }}
</p>
<div class="clearfix"></div>

The code above displays both the password and verification block. I would like to break this up into the 4 elements of form.plainPassword.label, form.plainPassword.field, form.plainPassword2.label, and form.plainPassword2.field. I cannot figure out what to put in the form_label() and form_widget() calls.

<p class="left">
   {{ form_label( ??? ) }}
   {{ form_widget( ??? ) }}
</p>
<p class="left">
   {{ form_label( ??? ) }}
   {{ form_widget( ??? ) }}
</p>
<div class="clearfix"></div>

I am assuming this can be done.

like image 478
Comstar Avatar asked Nov 28 '22 17:11

Comstar


1 Answers

I had the same problem. My solution (seems to be official :) :

{{ form_label (form.plainPassword.first) }}   
{{ form_widget (form.plainPassword.first) }}  

{{ form_label (form.plainPassword.second) }}   
{{ form_widget (form.plainPassword.second) }}

Hope it can helps !

like image 69
vinsse2001 Avatar answered Dec 05 '22 12:12

vinsse2001