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.                         {# @deprecated tag:v6.5.0 - Remove else cases, to maintain correct split of isoCode #}
  18.                         {% set language = feature('v6.5.0.0') ? isoCode[0] : isoCode[1] %}
  19.                         {% set country = feature('v6.5.0.0') ? isoCode[1] : isoCode[0] %}
  20.                         <div class="languages-menu dropdown">
  21.                             <button class="btn dropdown-toggle top-bar-nav-btn"
  22.                                     type="button"
  23.                                     id="languagesDropdown-{{ position }}"
  24.                                     {{ dataBsToggleAttr }}="dropdown"
  25.                                     aria-haspopup="true"
  26.                                     aria-expanded="false">
  27.                                 <div class="top-bar-list-icon language-flag country-{{ country }} language-{{ language }}"></div>
  28.                                 <span class="top-bar-nav-text">{{ page.header.activeLanguage.name }}</span>
  29.                             </button>
  30.                             {% block layout_header_actions_languages_widget_form_items %}
  31.                                 <div class="top-bar-list dropdown-menu dropdown-menu-right"
  32.                                     aria-labelledby="languagesDropdown-{{ position }}">
  33.                                     {% for language in  page.header.languages %}
  34.                                         <div class="top-bar-list-item dropdown-item{% if language.id is same as(page.header.activeLanguage.id) %} item-checked{% endif %}"
  35.                                              title="{{ language.translated.name }}">
  36.                                             {% block layout_header_actions_languages_widget_form_items_flag %}
  37.                                                 {% set isoCode = language.translationCode.code|lower|split('-') %}
  38.                                                 {# @deprecated tag:v6.5.0 - Remove else cases, to maintain correct split of isoCode #}
  39.                                                 {% set flagLanguage = feature('v6.5.0.0') ? isoCode[0] : isoCode[1] %}
  40.                                                 {% set flagCountry = feature('v6.5.0.0') ? isoCode[1] : isoCode[0] %}
  41.                                                 <label class="top-bar-list-label"
  42.                                                        for="{{ position }}-{{ language.id }}">
  43.                                                     <input id="{{ position }}-{{ language.id }}"
  44.                                                            class="top-bar-list-radio"
  45.                                                            value="{{ language.id }}"
  46.                                                            name="languageId"
  47.                                                            type="radio"
  48.                                                         {% if language.id is same as(page.header.activeLanguage.id) %} checked{% endif %}>
  49.                                                     <div class="top-bar-list-icon language-flag country-{{ flagCountry }} language-{{ flagLanguage }}"></div>
  50.                                                     {{ language.name }}
  51.                                                 </label>
  52.                                             {% endblock %}
  53.                                         </div>
  54.                                     {% endfor %}
  55.                                 </div>
  56.                             {% endblock %}
  57.                         </div>
  58.                         <input name="redirectTo" type="hidden" value="{{ app.request.get('_route') }}"/>
  59.                         {% for key, value in app.request.attributes.get('_route_params') %}
  60.                             <input name="redirectParameters[{{ key }}]" type="hidden" value="{{ value }}">
  61.                         {% endfor %}
  62.                     {% endblock %}
  63.                 </form>
  64.             {% endblock %}
  65.         </div>
  66.     {% endif %}
  67. {% endblock %}