{# {% set result = [] %} #}
{# {% set isTopProfilesExist = top_profile is defined and null != top_profile and null != profiles %}
{{dump( top_profile in profiles.array|keys )}}
{% if isTopProfilesExist and top_profile in profiles.array|keys %}
{% set result = [] %}
{% for key, profile in profiles.array %}
{% if profile != top_profile %}
{% set result = result|merge([profile])%}
{% endif %}
{% endfor %}
{% set result = [top_profile]|merge(result) %}
{% endif %}
{{dump( result )}} #}
{% set profiles_array = [] %}
{% if profiles != null %}
{% if profiles.array is defined %}
{# Legacy listing provider #}
{% set profiles_array = profiles.array %}
{% else %}
{# New listing microservice. Profiles array already contains top placement #}
{% set profiles_array = profiles %}
{% endif %}
{% endif %}
{% set hidePreferredButton = hidePreferredButton is defined ? hidePreferredButton : false %}
{% set likeButton = likeButton is defined ? likeButton : false %}
{%- set countHasOutPrice = 0 -%}
{%- for profile in profiles_array -%}
{# Наличие цены на выезд #}
{%- set isHasOutPricing =
profile.takeOutPricing.oneHourPrice is not null or
profile.takeOutPricing.twoHoursPrice is not null or
profile.takeOutPricing.nightPrice is not null
-%}
{# Колво цены на выезд #}
{% set countHasOutPrice = isHasOutPricing ? countHasOutPrice + 1 : countHasOutPrice %}
{# Нужно ли показывать пункт ВЫЕЗД в карточке профиля #}
{% set showOutProfileInfo = countHasOutPrice < 17 and isHasOutPricing %}
{%- set lazyLoad = loop.index == 1 -%}
{% include 'ProfileList/profile.html.twig' with {
profile: profile,
lazyLoad: lazyLoad,
isProfileTop: (loop.first and profile is top_placement),
showOutProfileInfo: showOutProfileInfo
} %}
{%- endfor -%}