{%- set route = app.request.attributes.get('_route') -%}
{%- set city = app.request.attributes.get('city') ?? null -%}
{%- set locale = app.request.locale ?? 'ru' -%}
{%- set isMainCity = city == default_city() -%}
{%- if item.children|length > 1 -%}
{# Перегоняем в индексированный массив #}
{% set children = [] %}
{% for breadcrumb_item in item.children %}
{% set children = children|merge([breadcrumb_item]) %}
{% endfor %}
{% if route == 'profile_preview.page' %}
{% set profile = options.profile ?? null %}
{% set station = profile.stations|length ? profile.stations[0] : null %}
{% set main = [{
label: 'Проститутки ' ~ city.name|geo_name('genitive'),
uri: path('profile_list.list_by_city', {city: city.uriIdentity})
}]%}
{# {Элитные|Дешевые|Дорогие} #}
{% set height = profile.personParameters.height|default(0) %}
{% set minPriceThreshold = isMainCity ? 3000 : 2000 %}
{% set maxPriceThreshold = isMainCity ? 15000 : 10000 %}
{% set isProfileCheapest = (profile.apartmentsPricing.oneHourPrice|default(0) >= minPriceThreshold) or
(profile.takeOutPricing.oneHourPrice|default(0) >= minPriceThreshold) %}
{% set isEliteProfile = height >= 170 and isProfileCheapest %}
{% set isProfileHighCost = (profile.apartmentsPricing.oneHourPrice|default(0) >= maxPriceThreshold) or
(profile.takeOutPricing.oneHourPrice|default(0) >= maxPriceThreshold) %}
{% if isEliteProfile %}
{# === Определяем, является ли профиль элитным === #}
{% set outputLink = path('profile_list.list_price_elite', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Элитные проститутки',
uri: outputLink
}]) %}
{% elseif isProfileCheapest %}
{# === Определяем, является ли профиль дешёвым === #}
{% set outputLink = path('profile_list.list_price_low', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Дешевые проститутки',
uri: outputLink
}]) %}
{% elseif isProfileHighCost %}
{# === Определяем, является ли профиль Дорогим === #}
{% set outputLink = path('profile_list.list_price_high', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: 'Дорогие проститутки',
uri: outputLink
}]) %}
{% endif %}
{# {Молодые|Взрослые} #}
{% set ageYoung = profile.personParameters.age < 22 %}
{% set outputAge = ageYoung ? 'Молодые' :
(profile.personParameters.age > 29 ? 'Взрослые' : '') %}
{% if outputAge %}
{% set outputAgeLink = ageYoung ?
path('profile_list.list_age_young', {'city': city.uriIdentity}) :
path('profile_list.list_age_older_than', {'city': city.uriIdentity}) %}
{% set main = main|merge([{
label: outputAge ~ ' проститутки',
uri: outputAgeLink
}]) %}
{% endif %}
{# Проверенное фото #}
{% if profile.approved %}
{% set main = main|merge([{
label: 'Проверенное фото',
uri: path('profile_list.list_approved', {'city': city.uriIdentity})
}]) %}
{% endif %}
{% if isMainCity %}
{% if station and station.district and station.district.county %}
{% set main = main|merge([{label: station.district.county.name|trans, uri: path('profile_list.list_by_county', {city: city.uriIdentity, county: station.district.county.uriIdentity})}]) %}
{% endif %}
{% if station and station.district %}
{% set main = main|merge([{label: station.district.name|trans, uri: path('profile_list.list_by_district', {city: city.uriIdentity, district: station.district.uriIdentity})}]) %}
{% endif %}
{% if profile and station %}
{% set main = main|merge([{label: station.name|trans , uri: path('profile_list.list_by_station', {city: city.uriIdentity, station: station.uriIdentity})}]) %}
{% endif %}
{% endif %}
{% set children = main|merge([children|last]) %}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
{% for breadcrumb_item in children %}
<li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
{% if not loop.last %}
<a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label }}</span></a>
{% else %}
<span property="name">{{ breadcrumb_item.label }}{{ profile.personParameters.age ? ', ' ~ profile.personParameters.age|plural('год') : '' }} ID {{ profile.id }}</span>
{% endif %}
<meta property="position" content="{{ loop.index }}">
</li>
{% endfor %}
</ul>
{% else %}
{%- set isProfileList = ('profile_list.' in route) and ('_pagination' in route) -%}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
{# Делаем првый элемент "Главная", второй - город #}
{#{% set main = city == default_city() ? [{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}#}
{% set main = isMainCity ? [{label: 'Главная', uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}
{% if 'profile_list.list_by_station' in route %}
{% set main = main|merge([{label: 'Метро' , uri: path('station_list.page', {city: city.uriIdentity})}]) %}
{% endif %}
{# Только для листинга С ПАГИНАЦИЕЙ #}
{%- if isProfileList -%}
{% set routeParams = app.request.attributes.get('_route_params') %}
{% set children = main|merge([{label: children|last.name, uri: path(route|replace({'._pagination': ''}), routeParams)}]) %}
{% set children = children|merge([{label: 'Страница ' ~ app.request.get('page')}]) %}
{%- else -%}
{% set children = main|merge([children|last]) %}
{% endif %}
{% for breadcrumb_item in children %}
<li class="{% if loop.last %}last-crumb{% endif %}" property="itemListElement" typeof="ListItem">
{% if not loop.last and breadcrumb_item.uri is defined %}
<a href="{{ breadcrumb_item.uri }}" property="item" typeof="WebPage"><span property="name">{{ breadcrumb_item.label }}</span></a>
{% else %}
<span {{ breadcrumb_item.classname is defined ? 'class=' ~ breadcrumb_item.classname : '' }} property="name">{{ breadcrumb_item.label }}</span>
{% endif %}
<meta property="position" content="{{ loop.index }}">
</li>
{% endfor %}
</ul>
{% endif %}
{% else %}
{% if (route == 'profile_list.list_by_city' or route == 'profile_list.list_by_city._pagination')
and city != default_city() %}
{#{% set main = city == default_city() ? [{label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}#}
{% set main = isMainCity ? [{label: 'Главная', uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] : [{label: 'Главная', uri: path('homepage')}, {label: city.name, uri: path('profile_list.list_by_city', {city: city.uriIdentity})}] %}
{% set children = main %}
<ul class="breadcrumbs" vocab="http://schema.org/" typeof="BreadcrumbList">
<li property="itemListElement" typeof="ListItem">
<a href="{{ (children|first).uri }}" class="std-hover-link" property="item" typeof="WebPage"><span property="name">{{ (children|first).label }}</span></a>
<meta property="position" content="0">
</li>
<li property="itemListElement" typeof="ListItem">
<span property="name">{{ (children|last).label }}</span>
<meta property="position" content="1">
</li>
</ul>
{% endif %}
{% endif %}