{% set depth = depth + 1 %}
{% set limit = limit - 1 %}
<ul
    class="
        {% if depth == 1 %}
            {{ first_container_class }}
        {% endif %}
    "
>
    {% for key, item in tree %}
        {% if item['id'] is empty %}
            {% set item_id = key + 1 %}
        {% else %}
            {% set item_id = item['id'] %}
        {% endif %}

        <li
            id="item_{{ item['id'] }}"
            class="
                {# Check if an array contains an id that item_id #}
                {% if item['sub'] is not empty %}
                    hasChildren
                {% endif %}
            "
        >
            <div>
                <i class="fa fa-arrow-circle-up toggleOpen" aria-hidden="true"></i>
                {% if item['data3'] is empty %}
                    <i class="fa fa-arrows move" aria-hidden="true"></i>
                {% endif %}

                {% if item['frontpage'] %}
                    <i class="fa fa-home type" aria-hidden="true"></i>
                {% elseif item['slug'] == "404" %}
                    <i class="type fa fa-exclamation-triangle"  aria-hidden="true"></i>
                {% elseif item['lock'] %}
                    <i class="type locked-page fa fa-file"  aria-hidden="true"></i>
                {% elseif item['type'] == "default" and item['published'] == 1 %}
                    <i class="type fa fa-file"  aria-hidden="true"></i>
                {% elseif item['type'] == "default" and item['published'] == 0 %}
                    <i class="type fa fa-file-o"  aria-hidden="true"></i>
                {% elseif item['type'] == "button" %}
                    <i class="type fa fa-plus-circle"  aria-hidden="true"></i>
                {% endif %}

                <a
                    title="{{ item['title'] }}"
                    href="/cms/admin/content_manager/?page={{ item['id'] }}"
                    target="_blank"
                >
                    {{ item['title'] }}
                </a>

            </div>
            {% if item['sub'] is not empty and (limit - 1) > 0 %}
                {% include _self.getTemplateName() with
                    {
                        'options': options,
                        'limit': limit,
                        'tree': item['sub'],
                        'depth': depth,
                        'first_container_class': first_container_class
                    }
                %}
            {% endif %}
        </li>
    {% endfor %}
</ul>
