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.
account.mail
would work? The code would suggestwithout
is one-dimensional, it doesn't do any special processing for render arrays within render arrays{{ form|without('account') }}
as @Clive says works only for one-dimmesion, you cannot nest keys.