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_by_station' in route %}
  33.     {% set items = [
  34.         crumbHomepage,
  35.         {label: 'Метро СПБ', uri: path('station_list.page', {city: city.uriIdentity})},
  36.         items|slice(1, 1)|first
  37.     ] %}
  38. {% elseif 'profile_list.list_by_provided_service' in route and (city.id != default_city().id) %}
  39.     {% set items = [
  40.         crumbHomepage,
  41.         {label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})},
  42.         items|slice(1, 1)|first
  43.     ] %}
  44. {% elseif 'profile_list.list_by_city' in route and (city.id != default_city().id) %}
  45.     {% set items = [
  46.         crumbHomepage,
  47.         {label: city.name|trans}
  48.     ] %}
  49. {% elseif 'profile_list.list_age_starye' in route %}
  50.     {% set items = [
  51.         crumbHomepage,
  52.         {label: 'Старые'}
  53.     ] %}
  54. {% elseif 'profile_list.list_bdsm' in route %}
  55.     {% set items = [
  56.         crumbHomepage,
  57.         {label: 'БДСМ проститутки '~city.name|geo_name('genitive')}
  58.     ] %}
  59. {% elseif 'profile_list.list_price_elite' in route %}
  60.     {%- set defaultCity = city.id == default_city().id -%}
  61.     {% set items = [
  62.         crumbHomepage,
  63.         {label: 'Элитные проститутки ' ~ (defaultCity ? 'Питера' : city.name|geo_name('genitive'))}
  64.     ] %}
  65. {% elseif 'profile_list.list_by_breast_type' in route %}
  66.     {% set breastType = app.request.get('breastType')|upper|trans({}, 'breast_types') %}
  67.     {% set items = [
  68.         crumbHomepage,
  69.         {label: breastType ~ ' грудь'}
  70.     ] %}
  71. {% elseif lastCrumbLabelInArticle is defined %}
  72.     {% if lastCrumbLabelInArticle == 'Статьи' %}
  73.         {% set items = [
  74.             {label: 'Главная', uri: path('homepage')},
  75.             {label: 'Статьи'}
  76.         ] %}
  77.     {% else %}
  78.         {% set items = [
  79.             {label: 'Главная', uri: path('homepage')},
  80.             {label: 'Статьи', uri: path('static_page.articles')},
  81.             {label: lastCrumbLabelInArticle}
  82.         ] %}
  83.     {% endif %}
  84. {% endif %}
  85. {% if items|length > 1 %}
  86.     <ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
  87.         {% for breadcrumb_item in items %}
  88.             <li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
  89.                 {% if not loop.last %}
  90.                     <a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  91.                 {% else %}
  92.                     <span property="name">{{ breadcrumb_item.label }}</span>
  93.                 {% endif %}
  94.                 <meta property="position" content="{{ loop.index }}">
  95.             </li>
  96.         {% endfor %}
  97.     </ul>
  98. {% endif %}