{% load cms_tags frontend %}
<nav{{ instance.get_attributes }}>
    {% if instance.navbar_container %}<div class="container">{% endif %}
        {% for plugin in instance.child_plugin_instances %}
            {% if plugin.plugin_type == "NavBrandPlugin" %}
                {% render_plugin plugin %}
            {% endif %}
        {% endfor %}
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#nav{{ instance.id|safe }}" aria-controls="nav{{ instance.id|safe }}" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="nav{{ instance.id|safe }}">
            <ul class="navbar-nav">
                {% for plugin in instance.child_plugin_instances %}
                   {% if plugin.plugin_type != "NavBrandPlugin" %}
                       {% with forloop=parentloop parent=instance %}{% render_plugin plugin %}{% endwith %}
                   {% endif %}
                {% endfor %}
            </ul>
        </div>
    {% if instance.navbar_container %}</div>{% endif %}
</nav>

