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