{% set profiles_array = [] %}
{% if profiles != null %}
{% if profiles.array is defined %}
{# Legacy listing provider #}
{% set profiles_array = profiles.array %}
{% if top_profile is defined and null != top_profile %}
{% set profiles_array = [top_profile]|merge(profiles_array) %}
{% endif %}
{% 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 %}
{%- for profile in profiles_array -%}
{%- set lazyLoad = loop.index == 1 -%}
{% include 'ProfileList/profile.html.twig' with {profile: profile, lazyLoad: lazyLoad} %}
{%- endfor -%}
{%- if app.request.method == 'GET' and app.request.isXmlHttpRequest() -%}
{{- porpaginas_render(profiles) -}}
{% endif %}