{{!
    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 core_form/element-header

    Renders a form section header

    Example context (json):
    {
        "id": "id_general",
        "header": "General",
        "collapsed": 0,
        "collapseable": 1,
        "helpbutton": "Help"
    }
}}
<legend class="sr-only">{{{header}}}</legend>
<div class="d-flex align-items-center mb-2">
    <div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">
        {{#collapseable}}
            <a data-toggle="collapse"
               href="#{{id}}container"
               role="button"
               aria-expanded="{{#collapsed}}false{{/collapsed}}{{^collapsed}}true{{/collapsed}}"
               aria-controls="{{id}}container"
               class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader {{#collapsed}}collapsed{{/collapsed}}"
            >
                <span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
                    {{#pix}} t/expandedchevron, core {{/pix}}
                </span>
                <span class="collapsed-icon icon-no-margin p-2" title="{{#str}} expand, core {{/str}}">
                    <span class="dir-rtl-hide">{{#pix}} t/collapsedchevron, core {{/pix}}</span>
                    <span class="dir-ltr-hide">{{#pix}} t/collapsedchevron_rtl, core {{/pix}}</span>
                </span>
                <span class="sr-only">{{{header}}}</span>
            </a>
        {{/collapseable}}
        <h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">
            {{{header}}}
        </h3>
    </div>
    {{{helpbutton}}}
</div>
<div id="{{id}}container" class="fcontainer {{#collapseable}}collapseable collapse {{/collapseable}} {{^collapsed}}show{{/collapsed}}">
