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 items = item.children %}
  4. {% set crumbHomepage = items|slice(0, 1)|first %}
  5. {% set crumbHomepage = {label: crumbHomepage ? crumbHomepage.label : '', uri: path('homepage')} %}
  6. {% if 'profile_preview.page' in route %}
  7.     {% set profile = app.request.get('profile') %}
  8.     {% set profileItem = {label: 'Индивидуалка ' ~ profile.name|trans ~ ' (' ~ profile.personParameters.age ~ ')', uri: '' } %}
  9.     {% if (city.id == default_city().id) %}
  10.         {% if profile.stations|length > 0 %}
  11.             {% set profileStation = profile.stations[0] %}
  12.             {% set items = [
  13.                 crumbHomepage,
  14.                 {label: 'Метро СПБ', uri: path('station_list.page', {city: city.uriIdentity})},
  15.                 {label: 'Проститутки ' ~ profileStation.name|trans, uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: profileStation.uriIdentity})},
  16.                 profileItem
  17.             ] %}
  18.         {% else %}
  19.             {% set items = [
  20.                 crumbHomepage,
  21.                 profileItem
  22.             ] %}
  23.         {% endif %}
  24.     {% else %}
  25.         {% set items = [
  26.             crumbHomepage,
  27.             {label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})},
  28.             profileItem
  29.         ] %}
  30.     {% endif %}
  31. {% elseif 'profile_list.list_by_station' in route %}
  32.     {% set items = [
  33.         crumbHomepage,
  34.         {label: 'Метро СПБ', uri: path('station_list.page', {city: city.uriIdentity})},
  35.         items|slice(1, 1)|first
  36.     ] %}
  37. {% elseif 'profile_list.list_by_provided_service' in route and (city.id != default_city().id) %}
  38.     {% set items = [
  39.         crumbHomepage,
  40.         {label: city.name|trans, uri: path('profile_list.list_by_city', {city: city.uriIdentity})},
  41.         items|slice(1, 1)|first
  42.     ] %}
  43. {% elseif 'profile_list.list_by_city' in route and (city.id != default_city().id) %}
  44.     {% set items = [
  45.         crumbHomepage,
  46.         {label: city.name|trans}
  47.     ] %}
  48. {% endif %}
  49. {% if items|length > 1 %}
  50.     <ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
  51.         {% for breadcrumb_item in items %}
  52.             <li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
  53.                 {% if not loop.last %}
  54.                     <a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label|trans({}, 'breadcrumbs') }}</span></a>
  55.                 {% else %}
  56.                     <span property="name">{{ breadcrumb_item.label }}</span>
  57.                 {% endif %}
  58.                 <meta property="position" content="{{ loop.index }}">
  59.             </li>
  60.         {% endfor %}
  61.     </ul>
  62. {% endif %}