{% set ajaxTarget = (item.level > 1) ? 'data-g5-ajaxify-target-parent=".submenu-column"' : 'data-g5-ajaxify-target="[data-g5-menu-columns]"' %}

{% set attributes = 'data-g5-ajaxify="" data-g5-ajaxify-params="' ~ ('{"inline":1}'|escape('html_attr')) ~ '" ' ~ ajaxTarget ~ ' href="' ~ gantry.route('menu', id, item.path)|e ~ '"' %}

<a {{ attributes|raw }} class="menu-item">
{% if item.type == 'particle' %}
    <span class="menu-item-content">
        <span class="menu-item-title">{{ item.title|e }}</span>
        {% if item.subtitle %}<span class="menu-item-subtitle">{{ item.subtitle|e }}</span>{% endif %}
    </span>
    <span class="badge menu-item-type">{{ item.particle|e }}</span>
{% else %}
    {% if item.image %}
        <img src="{{ url(item.image)|e }}" />
    {% elseif item.icon %}
        <i class="{{ item.icon|e }}"></i>
    {% endif %}
    {% if not item.icon_only or not (item.image or item.icon) %}
        <span class="menu-item-content">
            <span class="menu-item-title">{{ item.title|e }}</span>
                {% if item.subtitle %}<span class="menu-item-subtitle">{{ item.subtitle|e }}</span>{% endif %}
        </span>
    {% endif %}
    {% if (item.children) -%}
        <span class="parent-indicator"></span>
    {%- endif %}
{% endif %}
</a>
<a class="config-cog" href="{{ item.type == 'particle' ? gantry.route('menu/particle')|e : gantry.route('menu/edit', id, item.path)|e }}">
    <i class="fa fa-cog"></i>
</a>
