{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!

    @template theme_boost_union/primary-drawer-mobile-child

    This template renders the mobile version of the top navbar submenus in a drawer.

    Example context (json):
    {
        "text": "Dashboard",
        "url": "/my",
        "isactive": "true"
    }
}}

<a id="drop-down-{{sort}}" href="#" class="{{#itemdata.classes}} {{.}} {{/itemdata.classes}} list-group-item list-group-item-action icons-collapse-expand {{^isopen}}collapsed {{/isopen}}d-flex" title="{{tooltip}}" data-bs-toggle="collapse" data-bs-target="#drop-down-menu-{{sort}}" aria-expanded="{{#isopen}}true{{/isopen}}{{^isopen}}false{{/isopen}}" aria-controls="drop-down-menu-{{sort}}">
    {{{text}}}
    <span class="ms-auto expanded-icon icon-no-margin mx-2">
        {{#pix}} t/expanded, core {{/pix}}
        <span class="visually-hidden">
            {{#str}} collapse, core {{/str}}
        </span>
    </span>
    <span class="ms-auto collapsed-icon icon-no-margin mx-2">
        {{#pix}} t/collapsed, core {{/pix}}
        <span class="visually-hidden">
            {{#str}} expand, core {{/str}}
        </span>
    </span>
</a>
<div class="collapse {{#isopen}}show {{/isopen}}list-group-item p-0 border-0" role="menu" id="drop-down-menu-{{sort}}" aria-labelledby="drop-down-{{sort}}">
    {{#children}}
        <!-- Third level child support - Custom -->
        {{#haschildren}}
            {{> theme_boost_union/primary-drawer-mobile-child }}
        {{/haschildren}}

        {{^haschildren}}
            {{^divider}}
                <a href="{{{url}}}" {{#tooltip}}title="{{.}}" data-bs-toggle="tooltip"{{/tooltip}} class="ps-5 bg-light list-group-item list-group-item-action {{#itemdata.classes}} {{.}} {{/itemdata.classes}}" {{#attributes}} {{#name}}{{name}}="{{value}}"{{/name}} {{/attributes}}>
                    {{#icon.pix}}
                        {{#pix}}{{{icon.pix}}}, {{{icon.component}}}, {{{icon.alt}}}{{/pix}}
                    {{/icon.pix}}

                    {{{text}}}
                </a>
            {{/divider}}
        {{/haschildren}}

    {{/children}}
</div>
