This might be an pure oversight on my behalf, but is there a way to reorder fields in composite elements like the composite-address?

I need to put the postal_code before the city, because that is proper use of these two fields here in Germany.

When using flexbox display, I can overwrite the webform-composite-address.html.twig Template - but I am not sure whether that is the intended way to do this if flexbox is active.

And what to do, if Flexbox is not to be used?

Thanks for any insight,
Arngrim

Comments

Arngrim created an issue. See original summary.

jrockowitz’s picture

Status: Active » Needs review

You can still override the output without flexbox by replacing the {{ content }} with the individual elements.

templates/webform-composite-address.html.twig

{{ attach_library('webform/webform.element.composite') }}
{% if flexbox %}
   ....
{% else %}
  {{ content.address }}
  {{ content.address_2 }}
  {{ content.city }}
  {{ content.state_province }}
  {{ content.postal_code }}
  {{ content.country }}
{% endif %}

Does this make sense?

You could also alter the element weights via HOOK_preprocess_webform_composite_address().

jrockowitz’s picture

Status: Needs review » Closed (works as designed)