vendor/shopware/storefront/Resources/views/storefront/layout/header/actions/language-widget.html.twig line 1

Open in your IDE?
  1. {% block layout_header_actions_language_widget%}
  2.     {% if position is empty %}
  3.         {% set position = 'top-bar' %}
  4.     {% endif %}
  5.     {% if  page.header.languages.count > 1 %}
  6.         <div class="top-bar-nav-item top-bar-language">
  7.             {% block layout_header_actions_language_widget_form %}
  8.                 <form method="post"
  9.                       action="{{ path('frontend.checkout.switch-language') }}"
  10.                       class="language-form"
  11.                       data-form-auto-submit="true">
  12.                     {% block layout_header_actions_language_widget_form_csrf %}
  13.                         {{ sw_csrf('frontend.checkout.switch-language') }}
  14.                     {% endblock %}
  15.                     {% block layout_header_actions_language_widget_content %}
  16.                         {% set isoCode = page.header.activeLanguage.translationCode.code|lower|split('-') %}
  17.                         {% set country = isoCode[0] %}
  18.                         {% set language = isoCode[1] %}
  19.                         <div class="languages-menu dropdown">
  20.                             <button class="btn dropdown-toggle top-bar-nav-btn"
  21.                                     type="button"
  22.                                     id="languagesDropdown-{{ position }}"
  23.                                     data-toggle="dropdown"
  24.                                     aria-haspopup="true"
  25.                                     aria-expanded="false">
  26.                                 <div class="top-bar-list-icon language-flag country-{{ country }} language-{{ language }}"></div>
  27.                                 <span class="top-bar-nav-text">{{ page.header.activeLanguage.name }}</span>
  28.                             </button>
  29.                             {% block layout_header_actions_languages_widget_form_items %}
  30.                                 <div class="top-bar-list dropdown-menu dropdown-menu-right"
  31.                                     aria-labelledby="languagesDropdown-{{ position }}">
  32.                                     {% for language in  page.header.languages %}
  33.                                             <div class="top-bar-list-item dropdown-item{% if language.id is same as(page.header.activeLanguage.id) %} item-checked{% endif %}"
  34.                                                  title="{{ language.translated.name }}">
  35.                                                 {% block layout_header_actions_languages_widget_form_items_flag %}
  36.                                                     {% set isoCode = language.translationCode.code|lower|split('-') %}
  37.                                                     {% set flagCountry = isoCode[0] %}
  38.                                                     {% set flagLanguage = isoCode[1] %}
  39.                                                     <label class="top-bar-list-label"
  40.                                                            for="{{ position }}-{{ language.id }}">
  41.                                                         <input id="{{ position }}-{{ language.id }}"
  42.                                                                class="top-bar-list-radio"
  43.                                                                value="{{ language.id }}"
  44.                                                                name="languageId"
  45.                                                                type="radio"
  46.                                                             {% if language.id is same as(page.header.activeLanguage.id) %} checked{% endif %}>
  47.                                                         <div class="top-bar-list-icon language-flag country-{{ flagCountry }} language-{{ flagLanguage }}"></div>
  48.                                                         {{ language.name }}
  49.                                                     </label>
  50.                                                 {% endblock %}
  51.                                             </div>
  52.                                     {% endfor %}
  53.                                 </div>
  54.                             {% endblock %}
  55.                         </div>
  56.                         <input name="redirectTo" type="hidden" value="{{ app.request.get('_route') }}"/>
  57.                         {% for key, value in app.request.attributes.get('_route_params') %}
  58.                             <input name="redirectParameters[{{ key }}]" type="hidden" value="{{ value }}">
  59.                         {% endfor %}
  60.                     {% endblock %}
  61.                 </form>
  62.             {% endblock %}
  63.         </div>
  64.     {% endif %}
  65. {% endblock %}