templates/__design/v2023/_menu/breadcrumbs.html.twig line 1

Open in your IDE?
  1. {% set route = app.request.get('_route') %}
  2. {% set city = app.request.get('city') ?? null %}
  3. {% set isDefaultCity = city == default_city() %}
  4. {% set locale = app.request.locale ?? 'ru' %}
  5. {% set specialClass = specialClass is defined ? '' ~ specialClass : '' %}
  6. {% set isAccount = isAccount is defined ? isAccount : false %}
  7.  {# <div class="swiper" id="-swiper">
  8.     <div class="swiper-wrapper" id="-list">
  9.         <a class="swiper-slide" href=""> #}
  10. {% macro _breadcrumbs_generate(items) %}
  11.     <div class="swiper breadcrumbs-swiper list-swiper" id="breadcrumbs-swiper" style="padding:0">
  12.         <ul class="breadcrumbs swiper-wrapper" itemscope itemtype="https://schema.org/BreadcrumbList" id="breadcrumbs-list">
  13.             {% for breadcrumb_item in items %}
  14.                 <li class="breadcrumbs-item swiper-slide{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  15.                     {% if not loop.last %}
  16.                         <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  17.                     {% else %}
  18.                         <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span>
  19.                     {% endif %}
  20.                     <meta itemprop="position" content="{{ loop.index - 1 }}">
  21.                 </li>
  22.             {% endfor %}
  23.         </ul>
  24.         {# <div class="swiper-scrollbar swiper-loading"></div> #}
  25.         <div class="swiper-button-list swiper-loading">
  26.             <div class="swiper-button swiper-button-prev"><span class="swiper-button-wrap swiper-button-prev-wrap"></span></div>
  27.             <div class="swiper-button swiper-button-next"><span class="swiper-button-wrap swiper-button-next-wrap"></span></div>
  28.         </div>
  29.     </div>
  30. {% endmacro %}
  31. {% set mapArray = {
  32.     'profile_list.list_by_city': 'Индивидуалки',
  33.     'profile_list.list_by_city._pagination': 'Индивидуалки',
  34.     'profile_list.massage':'Массажистки',
  35.     'profile_list.massage._pagination':'Массажистки',
  36.     'saloon_list.list_by_city': 'Интим салоны',
  37.     'saloon_list.list_by_city._pagination': 'Интим салоны',
  38.     'profile_list.list_approved': 'Проверенные анкеты',
  39.     'profile_list.list_approved._pagination': 'Проверенные анкеты',
  40.     'profile_list.list_new': 'Новые анкеты',
  41.     'profile_list.list_new._pagination': 'Новые анкеты',
  42.     'profile_list.list_price_high': 'Элитные',
  43.     'profile_list.list_price_high._pagination': 'Элитные',
  44.     'profile_list.list_price_low': 'Дешевые',
  45.     'profile_list.list_price_low._pagination': 'Дешевые',
  46.     'profile_list.list_with_video': 'Анкеты с видео',
  47.     'profile_list.list_with_video._pagination': 'Анкеты с видео',
  48.     'profile_list.list_with_selfie': 'Анкеты с селфи',
  49.     'profile_list.list_with_selfie._pagination': 'Анкеты с селфи',
  50.     'profile_list.list_with_comments': 'Анкеты с отзывами',
  51.     'profile_list.list_with_comments._pagination': 'Анкеты с отзывами',
  52.     'profile_list.list_by_gender': 'Жиголо',
  53.     'profile_list.list_by_gender._pagination': 'Жиголо',
  54.     'profile_search.page': 'Расширенный поиск',
  55.     'profile_search.page._pagination': 'Расширенный поиск'
  56. } %}
  57. {% if route == null %}
  58.     {% set route = 'profile_list.massage' %}
  59. {% endif %}
  60. {# ТОЛЬКО ДЛЯ ЛК #}
  61. {% if isAccount %}
  62.     {{ _self._breadcrumbs_generate(items) }}
  63. {# ВСЁ ЧТО НИЖЕ ОТНОСИТСЯ К ПАБЛИКУ #}
  64. {% elseif (not isDefaultCity and 'profile_list.list_by_city' in route) %}
  65.     {% set items = [
  66.         {label: 'Главная', uri: path('homepage')}
  67.     ] %}
  68.     {% if not isDefaultCity %}
  69.         {% set items = items|merge([{label: city.name|trans}]) %}
  70.     {% endif %}
  71.     {{ _self._breadcrumbs_generate(items) }}
  72. {% elseif mapArray[route] is defined and not (isDefaultCity and 'profile_list.list_by_city' in route) %}
  73.     {% set items = [
  74.         {label: 'Главная', uri: path('homepage')}
  75.     ] %}
  76.     {% if not isDefaultCity %}
  77.         {% set items = items|merge([{label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}]) %}
  78.     {% endif %}
  79.     {% set items = items|merge([{label: mapArray[route]}]) %}
  80.     {{ _self._breadcrumbs_generate(items) }}
  81. {% elseif 'profile_list.list_by_district' in route %}
  82.     {% set district = app.request.attributes.get('district') ?? null %}
  83.     {% set items = [
  84.         {label: 'Главная', uri: path('homepage')},
  85.         {label: 'Все районы', uri: path('district_list.page', {city: district.city.uriIdentity})},
  86.         {label: district ? district.name|trans : '', uri: null}
  87.     ] %}
  88.     {{ _self._breadcrumbs_generate(items) }}
  89. {% elseif 'district_list.page' in route %}
  90.     {% set district = app.request.attributes.get('district') ?? null %}
  91.     {% set items = [
  92.         {label: 'Главная', uri: path('homepage')},
  93.         {label: 'Все районы'}
  94.     ] %}
  95.     {{ _self._breadcrumbs_generate(items) }}
  96. {% elseif 'station_list.page' in route %}
  97.     {% set district = app.request.attributes.get('district') ?? null %}
  98.     {% set items = [
  99.         {label: 'Главная', uri: path('homepage')},
  100.         {label: 'Все станции'}
  101.     ] %}
  102.     {{ _self._breadcrumbs_generate(items) }}
  103. {% elseif 'profile_list.list_by_station' in route %}
  104.     {% set station = app.request.attributes.get('station') ?? null %}
  105.     {# {% set items = [
  106.         {label: 'Главная', uri: path('homepage')},
  107.         {label: station ? 'Метро ' ~ station.name|trans : '', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity})}
  108.     ] %}
  109.     {% set page = current_listing_page() %}
  110.     {% if page and page.currentPage > 1 and page.totalCount > 0 %}
  111.         {% set items = items|merge([{label: 'Страница ' ~ page.currentPage ~ ' из ' ~ (page.totalCount / page.currentLimit)|round(0, 'ceil')}]) %}
  112.     {% endif %}
  113.     {#{label: 'Метро Москвы', uri: path('station_list.page')},#!}
  114.     <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
  115.         {% for breadcrumb_item in items %}
  116.             <li class="breadcrumbs-item{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  117.                 {% if not loop.last %}
  118.                     <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  119.                 {% else %}
  120.                     <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span>
  121.                 {% endif %}
  122.                 <meta itemprop="position" content="{{ loop.index - 1 }}">
  123.             </li>
  124.         {% endfor %}
  125.     </ul> #}
  126.     {% set items = [
  127.         {label: 'Главная', uri: path('homepage')},
  128.         {label: 'Все станции', uri: path('station_list.page', {'city': city.uriIdentity})},
  129.         {label: station ? 'Метро ' ~ station.name|trans : '', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity})}
  130.     ] %}
  131.     {{ _self._breadcrumbs_generate(items) }}
  132. {% elseif 'city_list.by_country' in route %}
  133.     {% set items = [
  134.         {label: 'Главная', uri: path('homepage')},
  135.         {label: 'По городам'}
  136.     ] %}
  137.     {{ _self._breadcrumbs_generate(items) }}
  138. {% elseif 'static_page.license' in route %}
  139.     {% set items = [
  140.         {label: 'Главная', uri: path('homepage')},
  141.         {label: 'Услувия использования'}
  142.     ] %}
  143.     {{ _self._breadcrumbs_generate(items) }}
  144. {# {% elseif 'profile_list.list_by_city' in route %}
  145.     {% set station = app.request.attributes.get('station') ?? null %}
  146.     {% set items = [
  147.         {label: 'Главная', uri: path('homepage')},
  148.         {label: 'Подмосквье', uri: path('city_list.by_country')},
  149.         {label: city.name|trans, uri: null}
  150.     ] %}
  151.     {% for breadcrumb_item in items %}
  152.         {% if not loop.last %}
  153.             {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs'), uri: breadcrumb_item.uri }]) %}
  154.         {% else %}
  155.             {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs') }]) %}
  156.         {% endif %}
  157.     {% endfor %} #}
  158. {% elseif item.children|length > 1 %}
  159.     {# Перегоняем в индексированный массив #}
  160.     {% set children = [] %}
  161.     {% for breadcrumb_item in item.children %}
  162.         {% set children = children|merge([breadcrumb_item]) %}
  163.     {% endfor %}
  164.     {% if route == 'profile_preview.page' %}
  165.         {#
  166.                 На странице анкеты Москвы выводим крошки вида
  167.                 Главная / ЗАО (то есть ссылка на округ) / Дорогомилово (то есть ссылка на район) / Кутузовская (то есть ссылка на метро) / индивидуалка Аня (Аня простым текстом, без ссылки)
  168.                 (согласно https://redminez.net/issues/27876),
  169.                 а на остальных Главная / Город / индивидуалка Имя
  170.         #}
  171.         {% set profile = options.profile ?? null %}
  172.         {% set items = [
  173.             {label: 'Главная', uri: path('homepage')}
  174.         ] %}
  175.         {% set children = items|merge([children[1]]) %}
  176.         {# {% set main = [
  177.             {label: 'Главная', uri: path('homepage')},
  178.             {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}
  179.         ] %}
  180.         {% set children = main|merge([children[1]]) %} #}
  181.         {# <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList">
  182.             <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  183.                 <a href="{{ (children|first).uri }}" itemprop="item"><span itemprop="name">{{ (children|first).label }}</span></a>
  184.                 <meta itemprop="position" content="0">
  185.             </li> #}
  186.             {% set position = 1 %}
  187.             {% if city and city.id == 1 %}
  188.                 {% if not profile.masseur and profile.personParameters.gender != gender_trans() and profile.personParameters.gender != gender_male() %}
  189.                     {% set station = profile.stations|length ? profile.stations[0] : null %}
  190.                     {#{% if profile and station and station.district and station.county %}#}
  191.                     {% if profile and station and station.county %}
  192.                         {% set items = items|merge([{label: station.county.name|trans, uri: path('profile_list.list_by_county', {city: city.uriIdentity, county: station.county.uriIdentity}) }]) %}
  193.                         {% set items = items|merge([{label: station.district.name|trans, uri: path('profile_list.list_by_district', {city: city.uriIdentity, district: station.district.uriIdentity}) }]) %}
  194.                         {% set items = items|merge([{label: station.name|trans, uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity}) }]) %}
  195.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  196.                             <a href="{{ path('profile_list.list_by_county', {city: city.uriIdentity, county: station.county.uriIdentity }) }}" itemprop="item"><span itemprop="name">{{ station.county.name|trans }}</span></a>
  197.                             <meta itemprop="position" content="1">
  198.                         </li> #}
  199.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  200.                             <a href="{{ path('profile_list.list_by_district', {city: city.uriIdentity, district: station.district.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ station.district.name|trans }}</span></a>
  201.                             <meta itemprop="position" content="2">
  202.                         </li> #}
  203.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  204.                             <a href="{{ path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ station.name|trans }}</span></a>
  205.                             <meta itemprop="position" content="1">
  206.                         </li> #}
  207.                         {% set position = 4 %}
  208.                     {% else %}
  209.                         {#
  210.                             если у анкеты нет станции, то:
  211.                             Южный (ЮАО), Донской, Ленинский проспект
  212.                         #}
  213.                         {% set items = items|merge([{label: locale == 'ru' ? 'Южный (ЮАО)' : 'South (SAD)', uri: path('profile_list.list_by_county', {city: city.uriIdentity, county: 'yuzhnyj-yuao' }) }]) %}
  214.                         {% set items = items|merge([{label: locale == 'ru' ? 'Донской' : 'Donskoy', uri: path('profile_list.list_by_district', {city: city.uriIdentity, district: 'donskoj'}) }]) %}
  215.                         {% set items = items|merge([{label: locale == 'ru' ? 'Ленинский проспект' : 'Leninskij prospekt', uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: 'leninskij-prospekt'}) }]) %}
  216.                         {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  217.                             <a href="{{ path('profile_list.list_by_county', {city: city.uriIdentity, county: 'yuzhnyj-yuao' }) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Южный (ЮАО)' : 'South (SAD)' }}</span></a>
  218.                             <meta itemprop="position" content="1">
  219.                         </li>
  220.                         <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  221.                             <a href="{{ path('profile_list.list_by_district', {city: city.uriIdentity, district: 'donskoj'}) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Донской' : 'Donskoy' }}</span></a>
  222.                             <meta itemprop="position" content="2">
  223.                         </li>
  224.                         <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  225.                             <a href="{{ path('profile_list.list_by_station', {city: city.uriIdentity, station: 'leninskij-prospekt'}) }}" itemprop="item"><span itemprop="name">{{ locale == 'ru' ? 'Ленинский проспект' : 'Leninskij prospekt' }}</span></a>
  226.                             <meta itemprop="position" content="1">
  227.                         </li> #}
  228.                         {% set position = 4 %}
  229.                     {% endif %}
  230.                 {% endif %}
  231.             {% else %}
  232.                 {% set items = items|merge([{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity}) }]) %}
  233.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  234.                     <a href="{{ path('profile_list.list_by_city', {city: city.uriIdentity}) }}" itemprop="item"><span itemprop="name">{{ city.name }}</span></a>
  235.                     <meta itemprop="position" content="1">
  236.                 </li> #}
  237.                 {% set position = 2 %}
  238.             {% endif %}
  239.             {% if profile.masseur %}
  240.                 {% set items = items|merge([{label: 'Массажистки', uri: path('masseur_list.page', {city: city.uriIdentity}) }]) %}
  241.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  242.                     <a href="{{ path('masseur_list.page', {city: city.uriIdentity}) }}" itemprop="item"><span itemprop="name">Массажистки</span></a>
  243.                     <meta itemprop="position" content="1">
  244.                 </li> #}
  245.             {% elseif profile.personParameters.gender == gender_trans() %}
  246.                 {# {% set items = items|merge([{label: 'Трансы', uri: path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_trans()|gender_uri}) }]) %} #}
  247.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  248.                     <a href="{{ path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_trans()|gender_uri}) }}" itemprop="item"><span itemprop="name">Трансы</span></a>
  249.                     <meta itemprop="position" content="1">
  250.                 </li> #}
  251.             {% elseif profile.personParameters.gender == gender_male() %}
  252.                 {# {% set items = items|merge([{label: 'Жиголо', uri: path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_male()|gender_uri}) }]) %} #}
  253.                 {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">
  254.                     <a href="{{ path('profile_list.list_by_gender', {city: city.uriIdentity, gender: gender_male()|gender_uri}) }}" itemprop="item"><span itemprop="name">Жиголо</span></a>
  255.                     <meta itemprop="position" content="1">
  256.                 </li> #}
  257.             {% endif %}
  258.             {# <li class="breadcrumbs-item" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> #}
  259.                 {% set profile_type_name = 'Индивидуалка' %}
  260.                 {% set profile_type_name = profile.masseur ? 'Массажистка' : profile_type_name %}
  261.                 {% set profile_type_name = profile.personParameters.gender == gender_trans() ? 'Мужчина' : profile_type_name %}
  262.                 {% set profile_type_name = profile.personParameters.gender == gender_male() ? 'Жиголо' : profile_type_name %}
  263.                 {% set breadcrumbs_list = profile_type_name ~ ' ' ~ children|last.label ~ ' ID' ~ profile.id %}
  264.                 {% set items = items|merge([{label: breadcrumbs_list }]) %}
  265.                 {# <span itemprop="name">{{ profile_type_name }} {{ children|last.label }} ID{{ profile.id }}</span> #}
  266.                 {# <meta itemprop="position" content="{{ position }}"> #}
  267.             {# </li> #}
  268.         {# </ul> #}
  269.             {{ _self._breadcrumbs_generate(items) }}
  270.         {% elseif route == 'saloon_preview.page' %}
  271.             {% set saloon = options.saloon ?? null %}
  272.             {# {% set main = [{label: 'Главная', uri: path('homepage')}] %}
  273.             {% set children = main|merge([children[1], children[2]]) %} #}
  274.             {% set items = [
  275.                 {label: 'Главная', uri: path('homepage')}
  276.             ] %}
  277.             {% set items = items|merge([children[1], children[2]]) %}
  278.             {{ _self._breadcrumbs_generate(items) }}
  279.     {% else %}
  280.         {# <ul class="breadcrumbs" itemscope itemtype="https://schema.org/BreadcrumbList"> #}
  281.             {% if route == 'profile_list.list_by_district' %}
  282.                 {# Убираем название округа #}
  283.                 {% set children = children | map((k) => k) | filter((v, k) => k != 2) %}
  284.             {% elseif route == 'profile_list.list_by_county' %}
  285.                 {# Убираем слово районы #}
  286.                 {% set children = [children[0], children[2]] %}
  287.             {% endif %}
  288.             {% if city.id == 1 %}
  289.                 {# Делаем првый элемент "Главная" #}
  290.                 {% set items = [
  291.                     {label: 'Главная', uri: path('homepage')}
  292.                 ] %}
  293.                 {% set children = items|merge([children[1]]) %}
  294.             {% else %}
  295.                 {# Делаем првый элемент "Главная", второй - город #}
  296.                 {% set items = [
  297.                     {label: 'Главная', uri: path('homepage')},
  298.                     {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}
  299.                 ] %}
  300.                 {% set children = items|merge([children[1]]) %}
  301.             {% endif %}
  302.             {% set items = [] %}
  303.             {% for breadcrumb_item in children %}
  304.                 {# <li class="breadcrumbs-item{% if loop.last %} last-crumb{% endif %}" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem"> #}
  305.                     {% if not loop.last %}
  306.                         {# <a href="{{ breadcrumb_item.uri }}" itemprop="item"><span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a> #}
  307.                         {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs'), uri: breadcrumb_item.uri }]) %}
  308.                     {% else %}
  309.                         {# <span itemprop="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span> #}
  310.                         {% set items = items|merge([{label: breadcrumb_item.label|trans({}, 'breadcrumbs') }]) %}
  311.                     {% endif %}
  312.                     {# <meta itemprop="position" content="{{ loop.index }}"> #}
  313.                 {# </li> #}
  314.             {% endfor %}
  315.         {# </ul> #}
  316.         {{ _self._breadcrumbs_generate(items) }}
  317.     {% endif %}
  318. {% endif %}