I have template form.html.twig Drupal commerce is using it to render cart form. I made override of that template, to be able to change it only for cart form, without affecting other forms. That part works well.
Form template looks like this:
<form class{{ attributes }}>
{{ children }}
</form>
Where "children" is markup. But (even not documented in template it self) there is also "element" array. So I can print the it instead of children and get the same results:
<form class{{ attributes }}>
{{ element }}
</form>
This also works well. Now, I need to print it piece by piece. If I put loop like this:
{% for single in element %}
{{ single }}
{% endfor %}
I get some form elements doubled, so obviously some elements must be excluded. But which ones?
Here is the list of all element keys inside this "element" array:
#action
#prefix
#suffix
#pre_render
#cache
#attached
#substitutions
#form_id
#type
#build_id
#token
#id
#attributes
#method
#theme_wrappers
#defaults_loaded
#tree
#parents
#validate
#submit
#theme
#processed
#required
#title_display
#description_display
#errors
#array_parents
#printed
show_view_elements
output
footer
edit_quantity
remove_button
form_build_id
form_token
form_id
actions
#sorted
#children
#render_children
How can I find out what elements should I print and what to exclude to get the same result (valid form) as when printing top element:
{{ element }}
Update: purpose of this is to render cart page a bit differently. Now, inside the form element I have first table with purchased items, then, bellow table goes div with sub-total and total prices and then div with "Update" and "Checkout" buttons. What I want is to display those 3 elements in 2 columns. In left one there should be only table with items and in right prices, buttons and some additional info.
BTW, I'm already displaying another form that way. It's template file looks like this:
<form{{ attributes }}>
{{ title_prefix }}
{{ element.pages }}
{{ element.elements }}
{{ element.form_build_id }}
{{ element.form_token }}
{{ element.form_id }}
{{ element.footer }}
{{ element.actions }}
{{ element.children }}
{{ element.progress }}
{{ title_suffix }}
</form>
There I print progress bar bellow the other form elements. But I have problem achieving the same with cart form.