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