How to print rest of the form using "without" function in twig while printing custom user field present account array? I am writing custom template to style my "edit user profile" form page.

Below is the code in twig file :

  {{ form.first_name }}

  {{ form.last_name }}

  {{ form.account.mail }}

  {{ form.account.current_pass }}

  {{ form.account.pass }}

  {{ form.actions }}

  {{ form|without('first_name', 'last_name', 'account.mail', 'account.current_pass', 'account.pass', 'actions') }}


The Problem is that it is print all account field for example account.mail. I guess it is is not understood by "without" function and it prints that field twice so I am unable to print all account custom field elements individually.

Here is the Dump output of twig form:



It is very important to print rest of the form using "without" function but "without" function printing my custom account field twice and not understanding that it is already printed on page.

Also I tried to directly use "account" as argument in without function which is working fine but this may miss some important content render which is present in account array. I want to render all account data except the fields which I want to print individually.
try to print it this way it gives you more control :

&lt;div id="candidature_spontanee" class="form-contact candidature_spontanee"&gt;

{# 1.use the attribute to set the form action and other attributes #}
&lt;form{{ attributes }}&gt;
 {{ title_prefix }}
 {{ title_suffix }}

     {# 2.print the form elment using : {{ element.elements.key }} #}
     &lt;div class="js-form-item form-item js-form-type-textfield form-item-nom js-form-item-nom form-group custom-input"&gt;
       {{ element.elements.nom }}
       &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
     &lt;/div&gt;

     &lt;div class="js-form-item form-item js-form-type-textfield form-item-nom js-form-item-nom form-group custom-input"&gt;
       {{ element.elements.telephone }}
       &lt;div class="help-block with-errors"&gt;&lt;/div&gt;
     &lt;/div&gt;


     {# 3.print the captcha if you have a cpatcha #}
     {{ element.captcha }}

     {# 4.you need to output a couple of hidden form elements that is required for the form to be submitted properly and securilly#}
     {{ element.form_token }}
     {{ element.form_build_id }}
     {{ element.form_id }}

     {# 5.output the form action (submit) at the end of the form link  #}
     {{element.actions }}

 &lt;/form&gt;

&lt;/div&gt;