Contact
{%- render 'section-header', subheading: section.settings.subheading, heading: section.settings.title, content: section.settings.content, text_alignment: 'center' -%}
{%- form 'contact', class: 'form' -%}
{%- if form.posted_successfully? -%}
{%- assign content = 'contact.form.success_message' | t -%}
{%- render 'banner', status: 'success', content: content -%}
{%- endif -%}
{%- if form.errors -%}
{%- capture content -%} {{ form.errors.translated_fields[form.errors.first] | capitalize }} {{ form.errors.messages[form.errors.first] }} {%- endcapture -%}
{%- render 'banner', status: 'error', content: content -%}
{%- endif -%}
{%- assign button_content = 'contact.form.submit' | t -%}
{%- render 'button', content: button_content, type: 'submit' -%}
{%- endform -%}
{%- assign label = 'contact.form.name' | t -%}
{%- render 'input', type: 'text', name: 'contact[name]', label: label, value: customer.name, required: true, autocomplete: 'name' -%}
{%- assign label = 'contact.form.email' | t -%}
{%- render 'input', type: 'email', name: 'contact[email]', label: label, value: customer.email, required: true, autocomplete: 'email' -%}
{%- for block in section.blocks -%}
{%- assign field_title = block.settings.title -%}
{%- if field_title == blank -%}
{%- capture field_title -%} Custom field {% increment custom_field %} {%- endcapture -%}
{%- endif -%}
{%- capture name -%} contact[ {{ field_title | escape }} ] {%- endcapture -%}
{%- if block.type == 'text' -%}
{%- if block.settings.use_long_text -%}
{%- render 'input', name: name, label: block.settings.title, required: block.settings.required, multiline: 4 -%}
{%- else -%}
{%- render 'input', type: 'text', name: name, label: block.settings.title, required: block.settings.required -%}
{%- endif -%}
{%- elsif block.type == 'dropdown' and block.settings.values != blank -%}
{%- assign values = block.settings.values | split: ',' -%}
{%- render 'select', option_values: values, show_empty_value: true, name: name, label: block.settings.title, required: true -%}
{%- endif -%}
{%- endfor -%}
{%- assign label = 'contact.form.message' | t -%}
{%- render 'input', name: 'contact[body]', label: label, multiline: 4, required: true -%}