custom/plugins/FourtwosixPhoneValidation/src/Resources/views/storefront/component/address/address-form.html.twig line 1

Open in your IDE?
  1. {% sw_extends '@Storefront/storefront/component/address/address-form.html.twig' %}
  2. {% block component_address_form_phone_number %}
  3.     {% if config('core.loginRegistration.showPhoneNumberField') and config('core.loginRegistration.showPhoneNumberField') %}
  4.         {% set fourtwosixExtension = page.extension('FourtwosixPhoneNumberCountryPrefix') ?? null %}
  5.         {% set ftsPhonePrefix = fourtwosixExtension["fts_prefixes"] %}
  6.         {# This can be address or page.address is passed as a parameter in vendor/shopware/storefront/Resources/views/storefront/component/address/address-editor-modal-create-address.html.twig #}
  7.         {% set ftsAddress = page.address ?? address %}
  8.         {% sw_include "@FourtwosixPhoneValidation/storefront/component/address/fts-telephone-country-prefixes.html.twig" with {
  9.             'fourtwosixExtension' : fourtwosixExtension,
  10.             'ftsPhonePrefix' : ftsPhonePrefix,
  11.             'ftsAddressId' : ftsAddress.id
  12.         } %}
  13.         {# @fourtwosix-edit: changed col-md-#  #}
  14.         <div class="form-group col-md-{{ config("FourtwosixPhoneValidation.config.active") ? '4' : '6' }}">
  15.             {% if formViolations.getViolations("/phoneNumber") is not empty %}
  16.                 {% set violationPath = "/phoneNumber" %}
  17.             {% elseif formViolations.getViolations("/#{prefix}/phoneNumber") is not empty %}
  18.                 {% set violationPath = "/#{prefix}/phoneNumber" %}
  19.             {% endif %}
  20.             {% block component_address_form_phone_number_label %}
  21.                 {{ parent() }}
  22.             {% endblock %}
  23.                 {% set addressCustomFields = ftsAddress.customFields["fourtwosix_customer_address_prefix"] ?? null %}
  24.                 {# Remove prefix. Note that to replace a variable it need to be passed within () otherwise wont work #}
  25.                 {% if addressCustomFields %}
  26.                     {% set getPhoneNumber = data.get('phoneNumber')|replace({(addressCustomFields) : ""}) %}
  27.                 {% else %}
  28.                     {% set getPhoneNumber = data.get('phoneNumber') %}
  29.                 {% endif %}
  30.             {# TODO TO TEST ----------------#}
  31.             {% do data.setPhoneNumber(getPhoneNumber) %}
  32.             {% block component_address_form_phone_number_input %}
  33.                 {{ parent() }}
  34.             {% endblock %}
  35.             {% block component_address_form_phone_error %}
  36.                 {{ parent() }}
  37.             {% endblock %}
  38.         </div>
  39.     {% else %}
  40.         {{ parent() }}
  41.     {% endif %}
  42. {% endblock %}