{% sw_extends '@Storefront/storefront/component/address/address-form.html.twig' %}
{% block component_address_form_phone_number %}
{% if context.shippingMethod.customFields.selfdelve_theme_shippingmethod_mandatory_phonenumber == true %}
<div class="form-group col-md-6">
{% if formViolations.getViolations("/phoneNumber") is not empty %}
{% set violationPath = "/phoneNumber" %}
{% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
{% set violationPath = "/#{prefix}/phoneNumber" %}
{% endif %}
<label class="form-label" for="{{ idPrefix ~ prefix }}AddressPhoneNumber">
{{ "address.phoneNumberLabel"|trans|sw_sanitize }}{{ "general.required"|trans|sw_sanitize }}
</label>
<input type="text"
class="form-control"
id="{{ idPrefix ~ prefix }}AddressPhoneNumber"
placeholder="{{ "address.phoneNumberPlaceholder"|trans|striptags }}"
name="{{ prefix }}[phoneNumber]"
value="{{ data.get('phoneNumber') }}"
required="true"
/>
<small class="form-text js-validation-message" data-form-validation-length-text="true">
{{ 'SelfdelveCms.main.checkout.shippingMethodRequiresPhoneNumber'|trans({'%name%': context.shippingMethod.name}) }}
</small>
{% if violationPath %}
{% sw_include '@Storefront/storefront/utilities/form-violation.html.twig' %}
{% endif %}
</div>
{% else %}
{{ parent() }}
{% endif %}
{% endblock %}