templates/_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 defaultCity = city.id == default_city().id -%}
  4. {% set items = item.children %}
  5. {% set crumbHomepage = items|slice(0, 1)|first %}
  6. {% set crumbHomepage = {label: crumbHomepage ? crumbHomepage.label : '', uri: path('homepage')} %}
  7. {% if 'profile_preview.page' in route %}
  8.     {% set profile = app.request.get('profile') %}
  9.     {% set profileItem = {label: 'Индивидуалка ' ~ profile.name|trans ~ ' (' ~ profile.personParameters.age ~ ')', uri: '' } %}
  10.     {% if (defaultCity) %}
  11.         {% if profile.stations|length > 0 %}
  12.             {% set profileStation = profile.stations[0] %}
  13.             {% set items = [
  14.                 crumbHomepage,
  15.                 {label: 'Метро СПБ', uri: path('station_list.page', {city: city.uriIdentity})},
  16.                 {label: 'Проститутки ' ~ profileStation.name|trans, uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: profileStation.uriIdentity})},
  17.                 profileItem
  18.             ] %}
  19.         {% else %}
  20.             {% set items = [
  21.                 crumbHomepage,
  22.                 profileItem
  23.             ] %}
  24.         {% endif %}
  25.     {% else %}
  26.         {% set items = [
  27.             crumbHomepage,
  28.             {label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})},
  29.             profileItem
  30.         ] %}
  31.     {% endif %}
  32. {%- elseif 'profile_list.list_height_tall' in route -%}
  33.     {% set items = [
  34.         crumbHomepage
  35.     ] %}
  36.     {%- if not defaultCity -%}
  37.         {% set items = items|merge([
  38.             {label: city.name|trans, uri: path('profile_list.list_by_city', {'city': city.uriIdentity})}  
  39.         ]) %}
  40.     {%- endif -%}
  41.     {% set items = items|merge([
  42.         {label: 'Высокие'}  
  43.     ]) %}
  44. {%- elseif 'profile_list.list_height_short' in route -%}
  45.     {% set items = [
  46.         crumbHomepage
  47.     ] %}
  48.     {%- if not defaultCity -%}
  49.         {% set items = items|merge([
  50.             {label: city.name|trans, uri: path('profile_list.list_by_city', {'city': city.uriIdentity})}  
  51.         ]) %}
  52.     {%- endif -%}
  53.     {% set items = items|merge([
  54.         {label: 'Низкие'}  
  55.     ]) %}
  56. {%- elseif 'profile_list.list_by_station_' in route %}
  57.     {# 
  58.         profile_list.list_by_station_uzbek
  59.         profile_list.list_by_station_mature
  60.         profile_list.list_by_station_cheap
  61.         profile_list.list_by_station_verified
  62.         profile_list.list_by_station_eromassage 
  63.     #}
  64.     {% set labelMap = {
  65.         'uzbek': 'Узбечки',
  66.         'mature': 'Зрелые',
  67.         'cheap': 'Недорогие',
  68.         'verified': 'Проверенные',
  69.         'eromassage': 'Эротический массаж'
  70.     } %}
  71.     {% set labelName = route|replace({'profile_list.list_by_station_': '', '._pagination': ''}) %}
  72.     {% set station = app.request.attributes.get('station') ?? null %}
  73.     {% set items = [
  74.         crumbHomepage
  75.     ] %}
  76.     {% if feature('has_station_list_page') %}
  77.         {% set items = items|merge([
  78.             {label: 'Метро СПБ', uri: path('station_list.page', {'city': city.uriIdentity})}  
  79.         ]) %}
  80.     {% endif %}
  81.     {% set items = items|merge([
  82.         {label: station.name|trans, uri: path('profile_list.list_by_station', {'city': station.city.uriIdentity, 'station': station.uriIdentity}) },
  83.         {label: labelMap[labelName] , uri: null}
  84.     ]) %}
  85. {% elseif 'profile_list.list_by_station' in route %}
  86.     {% set items = [
  87.         crumbHomepage,
  88.         {label: 'Метро СПБ', uri: path('station_list.page', {city: city.uriIdentity})},
  89.         items|slice(1, 1)|first
  90.     ] %}
  91. {% elseif 'profile_list.list_by_district_' in route %}
  92.     {# 
  93.         profile_list.list_by_district_uzbek
  94.         profile_list.list_by_district_mature
  95.         profile_list.list_by_district_cheap
  96.         profile_list.list_by_district_verified
  97.         profile_list.list_by_district_eromassage 
  98.     #}
  99.     {% set labelMap = {
  100.         'uzbek': 'Узбечки',
  101.         'mature': 'Зрелые',
  102.         'cheap': 'Недорогие',
  103.         'verified': 'Проверенные',
  104.         'eromassage': 'Эротический массаж'
  105.     } %}
  106.     {% set labelName = route|replace({'profile_list.list_by_district_': '', '._pagination': ''}) %}
  107.     {% set district = app.request.get('district') %}
  108.     {% set items = [
  109.         crumbHomepage,
  110.         {label: district.name|trans, uri: path('profile_list.list_by_district', {'city': city.uriIdentity, 'district': district.uriIdentity}) },
  111.         {label: labelMap[labelName] , uri: null}
  112.     ] %}
  113. {% elseif 'profile_list.list_by_county_' in route %}
  114.     {# 
  115.         profile_list.list_by_county_uzbek
  116.         profile_list.list_by_county_mature
  117.         profile_list.list_by_county_cheap
  118.         profile_list.list_by_county_verified
  119.         profile_list.list_by_county_eromassage 
  120.     #}
  121.     {% set labelMap = {
  122.         'uzbek': 'Узбечки',
  123.         'mature': 'Зрелые',
  124.         'cheap': 'Недорогие',
  125.         'verified': 'Проверенные',
  126.         'eromassage': 'Эротический массаж'
  127.     } %}
  128.     {% set labelName = route|replace({'profile_list.list_by_county_': '', '._pagination': ''}) %}
  129.     {% set okrug = app.request.get('county') %}
  130.     {% set items = [
  131.         crumbHomepage,
  132.         {label: okrug.name|trans, uri: path('profile_list.list_by_county', {'city': city.uriIdentity, 'county': okrug.uriIdentity}) },
  133.         {label: labelMap[labelName] , uri: null}
  134.     ] %}
  135. {% elseif 'profile_list.list_by_provided_service' in route and (city.id != default_city().id) %}
  136.     {% set items = [
  137.         crumbHomepage,
  138.         {label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})},
  139.         items|slice(1, 1)|first
  140.     ] %}
  141. {% elseif 'profile_list.list_by_city' in route and (city.id != default_city().id) %}
  142.     {% set items = [
  143.         crumbHomepage,
  144.         {label: city.name|trans}
  145.     ] %}
  146. {% elseif 'profile_list.list_age_starye' in route %}
  147.     {% set items = [
  148.         crumbHomepage,
  149.         {label: 'Старые'}
  150.     ] %}
  151. {% elseif 'profile_list.list_bdsm' in route %}
  152.     {% set items = [
  153.         crumbHomepage,
  154.         {label: 'БДСМ проститутки '~city.name|geo_name('genitive')}
  155.     ] %}
  156. {% elseif 'profile_list.list_price_elite' in route %}
  157.     {%- set defaultCity = city.id == default_city().id -%}
  158.     {% set items = [
  159.         crumbHomepage,
  160.         {label: 'Элитные проститутки ' ~ (defaultCity ? 'Питера' : city.name|geo_name('genitive'))}
  161.     ] %}
  162. {% elseif 'profile_list.list_by_breast_type' in route %}
  163.     {% set breastType = app.request.get('breastType')|upper|trans({}, 'breast_types') %}
  164.     {% set items = [
  165.         crumbHomepage,
  166.         {label: breastType ~ ' грудь'}
  167.     ] %}
  168. {% elseif lastCrumbLabelInArticle is defined %}
  169.     {% if lastCrumbLabelInArticle == 'Статьи' %}
  170.         {% set items = [
  171.             {label: 'Главная', uri: path('homepage')},
  172.             {label: 'Статьи'}
  173.         ] %}
  174.     {% else %}
  175.         {% set items = [
  176.             {label: 'Главная', uri: path('homepage')},
  177.             {label: 'Статьи', uri: path('static_page.articles')},
  178.             {label: lastCrumbLabelInArticle}
  179.         ] %}
  180.     {% endif %}
  181. {% endif %}
  182. {% if items|length > 1 %}
  183.     <ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
  184.         {% for breadcrumb_item in items %}
  185.             <li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
  186.                 {% if not loop.last %}
  187.                     <a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  188.                 {% else %}
  189.                     <span property="name">{{ breadcrumb_item.label }}</span>
  190.                 {% endif %}
  191.                 <meta property="position" content="{{ loop.index }}">
  192.             </li>
  193.         {% endfor %}
  194.     </ul>
  195. {% endif %}