{{!
    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/>.

    Edwiser RemUI
    @package theme_remui
    @copyright (c) 2023 WisdmLabs (https://wisdmlabs.com/)
    @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
}}
{{!

    @template theme_boost/editswitch

    This template renders the top navbar.

    Example context (json):
    {
        "url": "http://localhost/",
        "sesskey": "sesskey",
        "edit": 1,
        "adminedit": true,
        "checked": "",
        "string": "Edit on",
        "legacyseturl": "/editmode.php"
    }
}}

<li class="nav-item d-flex align-items-center">
    <form action="{{{legacyseturl}}}" method="post" class="d-flex align-items-center editmode-switch-form m-0" title="{{#str}}editmodeswitch, theme_remui{{/str}}">
        <div class="input-group">
            <label class="mr-2 mb-0 {{#checked}}text-primary{{/checked}} sr-only" for="{{uniqid}}-editingswitch">
                {{#str}} editmode {{/str}}
            </label>
            <div class="custom-control custom-switch d-flex">
                <input type="checkbox"{{!
                    }} name="setmode"{{!
                    }}{{#checked}}{{!
                        }} checked{{!
                    }}{{/checked}}{{!
                    }} class="custom-control-input"{{!
                    }} id="{{uniqid}}-editingswitch"{{!
                    }} data-context="{{{pagecontextid}}}"{{!
                    }} data-pageurl="{{{pageurl}}}"{{!
                }}>
                <span class="custom-control-label">&nbsp;</span>
            </div>
        </div>
        <input type="hidden" name="sesskey" value="{{{sesskey}}}">
        <input type="hidden" name="pageurl" value="{{{pageurl}}}">
        <input type="hidden" name="context" value="{{{pagecontextid}}}">
        <noscript>
            <input type="submit" value="{{#str}}setmode, core{{/str}}">
        </noscript>
    </form>
</li>

{{#js}}
require(['core/edit_switch'], function(editSwitch) {
    editSwitch.init('{{uniqid}}-editingswitch');
});
{{/js}}
