{% if channels|length > 1 %}

{% set selected = channels|first %}
{% set code = app.request.query.get('channel') %}

{% for channel in channels %}
    {% if channel.code is sameas(code) %}
        {% set selected = channel %}
    {% endif %}
{% endfor %}

<div class="ui floating dropdown labeled icon button">
    <i class="share alternate icon"></i>
    <span class="text">
        {% include '@SyliusAdmin/Common/_channel.html.twig' with {'channel': selected} %}
    </span>
    <div class="menu">
        <div class="ui icon search input">
            <i class="search icon"></i>
            <input type="text" placeholder="{{ 'sylius.ui.search'|trans }}...">
        </div>
        <div class="scrolling menu">
            {% for channel in channels %}
                <a href="{{ path('sylius_admin_dashboard', {'channel': channel.code}) }}" class="item">
                    {% include '@SyliusAdmin/Common/_channel.html.twig' %}
                </a>
            {% endfor %}
        </div>
    </div>
</div>
{% endif %}

{% if channels|length > 1 %}

{% set selected = channels|first %}
{% set code = app.request.query.get('channel') %}

{% for channel in channels %}
    {% if channel.code is same as(code) %}
        {% set selected = channel %}
    {% endif %}
{% endfor %}

<div class="ui floating dropdown labeled icon button">
    <i class="share alternate icon"></i>
    <span class="text">
        {% include '@SyliusAdmin/Common/_channel.html.twig' with {'channel': selected} %}
    </span>
    <div class="menu">
        <div class="ui icon search input">
            <i class="search icon"></i>
            <input type="text" placeholder="{{ 'sylius.ui.search'|trans }}...">
        </div>
        <div class="scrolling menu">
            {% for channel in channels %}
                <a href="{{ path('sylius_admin_dashboard', {'channel': channel.code}) }}" class="item">
                    {% include '@SyliusAdmin/Common/_channel.html.twig' %}
                </a>
            {% endfor %}
        </div>
    </div>
</div>
{% endif %}

Use "same as" instead of deprecated "sameas" in Twig
Use "same as" instead of deprecated "sameas" in Twig
